Vegas Fred Posted July 24, 2019 Posted July 24, 2019 (edited) I am trying to join multiple PDFs in to one PDF. The issue I am having is that the page numbers are not displaying correctly. It will list the page number as 1, 2, 2, 2, 2 etc instead of 1, 2 ,3 ,4, 5. My code looks like: #Setting the desitination Set Variable [ $dFilename ; Value: "/" & builderdoc.builder.file::file_number_n &" " & builderdoc.Builder::name_t & ".pdf" ] Set Variable [ $destPath ; Value: MBS("Folders.SystemTemporary") & $dFilename ] #New PDF Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ] Set Variable [ $r ; Value: MBS("DynaPDF.OpenOutputFile"; $pdf; $destPath) ] #Loop though records and merge pdfs Set Variable [$Page ; Value: 1] Loop Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; builderdoc.Doc::document_r) ] Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; $Page) ] If [ GetAsNumber ( $r ) > 0 ] Set Variable [ $Page ; Value: $r+1 ] End If Set Variable [ $r ; Value: MBS("DynaPDF.FlushPages"; $pdf; $Page) ] Go to Record/Request/Page [ Next ; Exit after last: On ] End Loop #Close the PDF Set Variable [ $Merge ; Value: MBS("DynaPDF.Save"; $pdf; "Merged.pdf") ] Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ] Let me know if more details will help. Thank you for taking a look! -=fred=- Edited July 26, 2019 by Vegas Fred Solved issue
MonkeybreadSoftware Posted July 25, 2019 Posted July 25, 2019 Do the pages already have page numbers? Do you want to add new page numbers? To add page numbers, you may need to draw white rectangles over the old page number and add new ones.
Vegas Fred Posted July 25, 2019 Author Posted July 25, 2019 Thank you for your response! I apologize that I did not explain myself well. After merging the PDF the displayed page number in the Adobe software is not correct. For example, at the top where it list what page you are on: It shows that I am on page number 2, but it is 31 of 441. Also on the thumbnail view: ( I did cover up the actual contents of the pages ) Hopefully that makes more sense. -=fred=-
Vegas Fred Posted July 26, 2019 Author Posted July 26, 2019 I found a solution. Apparently a PDF in my import set had page labels that were causing issues with the merge. So I had to filter what things get imported with the PDF via the MBS( "DynaPDF.SetImportFlags"; PDF; Flags ). The filter that I am currently using is : ImportAsPage So now right after I set up the new PDF in memory space I set the filter : #New PDF Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ] #Set PDF Filter Set Variable [ $r ; Value: MBS("DynaPDF.SetImportFlags"; $pdf; "ImportAsPage") ] #Set File Destination Set Variable [ $r ; Value: MBS("DynaPDF.OpenOutputFile"; $pdf; $destPath) ] So far this is working with the PDF that were giving me issues. Hopefully this will help others out. -=fred=-
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now