PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

VB 2010 Form to PDF
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1438
Page 1 of 1

Author:  bradhen [ Thu Nov 25, 2010 5:03 am ]
Post subject:  VB 2010 Form to PDF

In my application I create an Invoice is a VB form and print it as a screen snapshot using BitBlt. I need to provide email functionality and I think creating s PDF using PDFSharp and emailing that pdf file would be the best option. Is it possible to input the BitBlt screen snapshot to PDFSharp? Thank you in anticipation. Brad

Author:  Thomas Hoevel [ Thu Nov 25, 2010 8:57 am ]
Post subject:  Re: VB 2010 Form to PDF

bradhen wrote:
BitBlt screen snapshot

What's a "BitBlt screen snapshot"? Is it a MemoryDC?

You need an XImage for PDFsharp. XImages can be created from Files and from Images (GDI+ images).

Why don't you e-mail the screen shot as a GIF or PNG file?
A screen shot in a PDF file will still be a screen shot - and when people zoom in or print it it will look like a screen shot.

You might use MigraDoc to re-create the invoice. Fonts will then be smooth even when zoomed at the highest level and it can look like an invoice, not like a screen shot.
Yep, it's extra work - but it might be worth it.

Author:  bradhen [ Mon Nov 29, 2010 6:36 am ]
Post subject:  Re: VB 2010 Form to PDF

Hello Thomas,
Thank you for your response, I have decided to use PDFSharp's Drawstring capability to create the invoice rather than use VB forms and grab that portion of the screen. By using Drawstring I have more control, however I can't find how to create multiple pages. I won't always know how many pages I will print some invoices are one page some may be 5 or ten pages. I can add a new page using document.addpage() but when I try to use drawstring I overwrite the first page - still referring to the first page. Do you have a sample of creating a multiple page document? Thanks again for an excellent product.
Brad

Author:  Thomas Hoevel [ Mon Nov 29, 2010 12:27 pm ]
Post subject:  Re: VB 2010 Form to PDF

If you create a new page, also create a graphics object to draw on the new page.

Or better use MigraDoc when you need automatic page breaks.
There even is a MigraDoc Invoice sample ...

Author:  bradhen [ Wed Dec 08, 2010 6:09 am ]
Post subject:  Re: VB 2010 Form to PDF

Thomas,
The PDFSharp is working well and creating multiple pages. I am having another concern with the document.save, at times its almost immediate and others it can take up to 20-25 seconds to save the file. Is there anything I can do to speed this up??
Thanks again
Brad

Author:  Thomas Hoevel [ Wed Dec 08, 2010 9:05 am ]
Post subject:  Re: VB 2010 Form to PDF

bradhen wrote:
Is there anything I can do to speed this up??

With PDFsharp there are no performance problems I'm aware of.

So maybe this problem is not with PDFsharp (a hard disk that has to speed up, a network connection causing delay, DDLs being loaded for the first time, or something completely different).

Author:  bradhen [ Wed Dec 08, 2010 10:41 pm ]
Post subject:  Re: VB 2010 Form to PDF

Thanks Thomas,
I'll look elsewhere for the cause. Its very erratic some times the save is immediate other times its up to 28 seconds. Very confusing.

Brad

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/