Jump to content

Page numbers wrong in PDF after Merge {Solved}


This topic is 1729 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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 by Vegas Fred
Solved issue
Link to comment
Share on other sites

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. 

909532509_ScreenShot2019-07-25at8_41_23AM.png.2b9775cae562620d7cb1eb48ea7ff2f8.png

Also on the thumbnail view:

1552380881_ScreenShot2019-07-25at8_41_40AM.thumb.png.05f7ac26f95aa3ba5029ea4b93e5f59c.png
( I did cover up the actual contents of the pages ) 


Hopefully that makes more sense. 

-=fred=-
 

Link to comment
Share on other sites

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=-

Link to comment
Share on other sites

This topic is 1729 days old. Please don't post here. Open a new topic instead.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.