July 24, 20196 yr 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, 20196 yr by Vegas Fred Solved issue
July 25, 20196 yr 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.
July 25, 20196 yr Author 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=-
July 26, 20196 yr Author 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=-
Create an account or sign in to comment