PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Apr 25, 2024 9:15 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Feb 10, 2015 8:28 pm 
Offline

Joined: Sat Oct 27, 2012 9:38 pm
Posts: 5
Hello, i create a New PdfDocument from a existing Document.
Code:
 Dim document As PdfDocument = IO.PdfReader.Open(docPath, IO.PdfDocumentOpenMode.Modify)
        document.Info.Title = "Created with PlanMass"
        Dim page As PdfPage = document.Pages(0)
        Dim gfx As XGraphics = XGraphics.FromPdfPage(page)
        'expScale = CDbl(gfx.PdfPage.Width) / Dts.Canvas.Bitmap.Width
        'For Each fig In Dts.Figure
        '    Select Case fig.Type
        '        Case MeasureTypes.Line
        '            If fig.PlanMassRow.LayersRow Is Layer AndAlso Not fig.IsText Then pdfCreateLine(gfx, fig)
        '        Case MeasureTypes.Area
        '            If fig.PlanMassRow.LayersRow Is Layer AndAlso Not fig.IsText Then pdfCreateArea(gfx, fig)
        '        Case MeasureTypes.Quantity
        '            If fig.PlanMassRow.LayersRow Is Layer AndAlso Not fig.IsText Then pdfCreateQuantity(gfx, fig)
        '    End Select
        '    If fig.PlanMassRow.LayersRow Is Layer AndAlso fig.IsText Then pdfCreateText(gfx, fig)
        'Next
        ' Save the document...
        Dim filename As String = String.Concat(System.IO.Path.GetDirectoryName(docPath), "\", "Export_", Layer.Name, "_", System.IO.Path.GetFileName(docPath))
        document.Save(filename)

But the new Document is smaller then the Original. ~ 50%

What can i do?

Thanks Christian


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 11, 2015 8:50 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Hi!

The code shown here opens the file and saves it again. Is that enough to reduce the size?
Does this happen with all files or only with some files?
Which version are you using?

See also:
viewtopic.php?f=2&t=832

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 11, 2015 4:35 pm 
Offline

Joined: Sat Oct 27, 2012 9:38 pm
Posts: 5
Hi, Sorry im using Version 1_31.

I think the Problem is the Papersize / orientation.

The File is Format DIN A0, orientation landscape. But the Output is Orientation Portrait

it is by each File in this Orientation.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 335 guests


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 post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group