|
PDFsharp - moved to http://forum.pdfsharp.net/ Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
|
Important Notice:
We regret to inform you that our free phpBB forum hosting service will be discontinued by the end of June 30, 2024.
If you wish to migrate to our paid hosting service, please contact billing@hostonnet.com.
View previous topic :: View next topic |
Author |
Message |
sidpoonja
Joined: 21 Aug 2008 Posts: 2 Location: New York
|
Posted: Fri Aug 22, 2008 11:23 am Post subject: Adding simple text increasing size of PDF dramatically |
|
|
I have an application that uses a GIS framework to export a PDF document (which is basically a map). I then need to stamp this PDF with some custom information (just two lines of simple text) for which I use PDFSharp and create a new PDF document. The utility works great. The only problem is that the size of the resultant document (created by PDFSharp) is so much larger. For eg: one PDF file that was orginally 184KB became 712KB when created with PDF Sharp. Now the PDF Exporter of the GIS framework has a DPI setting. Is there something similar with PDFSharp?
here is the code i used to generated the PDF.
pdfDocument = PdfReader.Open(inputFile)
For Each page As PdfPage In pdfDocument.Pages
Dim xgfx As XGraphics = XGraphics.FromPdfPage(page)
xgfx.DrawString("As of Date : " + effectiveDate, dateFont, XBrushes.Black, effDateLocation)
page.Close()
Next
pdfDocument.Save(outputFile)
pdfDocument.Close() |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: Mon Aug 25, 2008 7:33 am Post subject: |
|
|
Are you using a DEBUG build of PDFsharp?
Have you tried a RELEASE build? _________________ Regards
Thomas Hoevel
PDFsharp Team |
|
Back to top |
|
|
sidpoonja
Joined: 21 Aug 2008 Posts: 2 Location: New York
|
Posted: Mon Aug 25, 2008 11:19 pm Post subject: |
|
|
Hi Thomas,
Thanks for your reply. I was able to fix the problem. After I got a reference to the PDFDocument object, I set two of its properties:
PDFDocument.CompressContentStreams = True
PDFDocument.NoCompression = False
and that seemed to do the job. Now the size of the new PDF is only marginally larger than the original PDF (which is expected). |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|