LEADTOOLS Support
Document
Document SDK Questions
How to print multi pages in one task using ClassLibrary(MSVC)?
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, November 23, 2007 5:23:39 AM(UTC)
Groups: Registered
Posts: 5
We want to print all images in one directory one by one, could we print all the pages at one time?
We are using Lead tools 15 ClassLibrary, Visual Studio .net 2005.
Thanks in advance.
Best Regards
Victorsow
#2
Posted
:
Sunday, November 25, 2007 7:30:19 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Do you mean you want to print more than one image on the same printer page? If yes, please see these forum posts:
-http://support.leadtools.com/SupportPortal/cs/forums/5634/ShowPost.aspx
-http://support.leadtools.com/SupportPortal/cs/forums/7780/ShowPost.aspx
If you mean something else, please explain it in more details.
#3
Posted
:
Monday, November 26, 2007 4:08:05 AM(UTC)
Groups: Registered
Posts: 5
I mean print image1 on page 1, image2 on page2...
but print all the pages in one print job
something like(it can't work)
//Begin a print job
LBitmapBase MyBitmap;
LPrint MyPrint;
//start page1
MyBitmap.Load(TEXT("C:\\Image1.cmp"));
MyPrint.SetBitmap(&MyBitmap);
//print page1
HDC hdcPrinter = MyPrint.Print(NULL, 0, 0, 0, 0, FALSE);
EndPage(hdcPrinter);
StartPage(hdcPrinter);
//start page2
MyBitmap.Load(TEXT("C:\\Image2.cmp"));
MyPrint.SetBitmap(&MyBitmap);
//print another page
MyPrint.Print();
//end the print job
#4
Posted
:
Wednesday, November 28, 2007 12:22:09 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
The second MyPrint.Print();
is not using the same HDC of the first Print() command, this causes the second
image to be printed to a different job.
Instead,
you should pass the second print command like this MyPrint.Print(hdcPrinter);
Tell
me if this solves the problem for you.
#5
Posted
:
Wednesday, November 28, 2007 5:42:05 PM(UTC)
Groups: Registered
Posts: 5
Thank you very much, Adam! It works very well.
The correct code is:
//Begin a print job
LBitmapBase MyBitmap;
LPrint MyPrint;
//start page_1
MyBitmap.Load(TEXT("C:\\Image_1.cmp"));
MyPrint.SetBitmap(&MyBitmap);
//print page_1
HDC hdcPrinter = MyPrint.Print(NULL, 0, 0, 0, 0, FALSE);
EndPage(hdcPrinter);
//start page_2
StartPage(hdcPrinter);
MyBitmap.Load(TEXT("C:\\Image_2.cmp"));
MyPrint.SetBitmap(&MyBitmap);
//print page_2
MyPrint.Print(hdcPrinter, 0, 0, 0, 0, FALSE);
EndPage(hdcPrinter);
//...
//start page_n
StartPage(hdcPrinter);
MyBitmap.Load(TEXT("C:\\Image_n.cmp"));
MyPrint.SetBitmap(&MyBitmap);
//print page_n
MyPrint.Print(hdcPrinter);
//end the print job
LEADTOOLS Support
Document
Document SDK Questions
How to print multi pages in one task using ClassLibrary(MSVC)?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.