pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkuehler <andr...@lehmi.de>
Subject Re: Appending Documents Using PDFMergerUtility Creates Duplicate Resources
Date Mon, 14 May 2012 20:28:34 GMT
Hi,

what version of PDFBox do you use?

BR
Andreas Lehmkühler

Am 14.05.2012 16:48, schrieb Glenn Wadden:
> Hi,
>
> I am fairly new to using PDFBOX (using the .net version).  Everything
> seems to be going very well on my project, however whenever we append
> documents using the PDFPDFMergerUtility our merged PDF document is quite
> large and contains duplicate resources.
>
> After the merged PDF is created, when opened and "File ->  Save As" is
> selected the following messages are received at the bottom of the screen:
>
>
> "Consolidating duplicate Fonts"
>
> After saving the PDF it is approximately half the size that it was merged
> out of PDFbox.
>
> Here is a consolidated look at our code:
>
>    Private Function MergePdfFiles(ByVal pdfFileList As List(Of String), _
>                                     ByVal outputFileFullName As String) As
> Boolean
>          Dim result As Boolean = False
>          Dim fileCount As Integer = pdfFileList.Count
>          Dim iPDF As New PDDocument
>          Dim oPDF As New PDDocument
>          Dim catalogFlag As Boolean = False
>          Dim version As Decimal = 1.8
>
>          If fileCount>  1 Then
>              Try
>                  'Instantiate an instance of Pdf Merger Utility
>                  Dim oPDFmerger As PDFMergerUtility = New PDFMergerUtility
>
>                  With oPDFmerger
>                      'Set output destination
>                      oPDFmerger.setDestinationFileName(outputFileFullName)
>                      'Looping thru the file list and add source to the
> merger
>                      For i As Integer = 0 To fileCount - 1 Step 1
>                          iPDF = PDDocument.load(pdfFileList(i))
>                          oPDFmerger.appendDocument(oPDF, iPDF)
>                      Next i
>                      oPDFmerger.mergeDocuments()
>                      'Merge the documents
>                      result = True
>                  End With
>                  oPDF.save(outputFileFullName)
>              Catch ex As Exception
>                  WriteToLog("MergePDFFile("&  outputFileFullName&  "): "&
> ex.Message)
>                  Return False
>              End Try
>          End If
>          Return result
>      End Function
>
> Glenn Wadden
> glenn.wadden@rogers.com
>
> STATEMENT OF CONFIDENTIALITY
>
> The information contained in this email message and any attachments may be confidential
and legally privileged and is intended for the use of the addressee(s) only.  If you are not
an intended recipient, please: (1) notify me immediately by replying to this message; (2)
do not use, disseminate, distribute or reproduce any part of the message or any attachment;
and (3) destroy all copies of this message and any attachments.
>


Mime
View raw message