Merge of PDF - some are flipped in the combined PDF

Hello,

i combine several PDF with
pdf.MergePDFFiles (2.4.0)
the original PDF are all in the right direction, when i view them with an PDF Viewer.
When i combine the PDF’s, some of them are flipped in the combined PDF.
Waht could be the reason for this behaviour ?

Thanks
Mark

Hi,

have you tried printing the ones that appear fliiped sepaeratly, to make sure the problem is caused by merging?

regards,

Robin

Hello Robin,

i have two documents. When i print or view them the orientation is ok.
Then when i merge this to documents the second is flipped in view and print.
Maybe i could send you this documents so you can check it.

Thanks
Mark

Hi,

I can gladly check it if you send them to support@pdfforge.org,
in the meanwhile you can try changing the setting in options->formats->pdf->auto rotate pages to see if the problem can be solved by this.

regards,

Robin

Hello Robin,

where to set this option when i use the pdfforge.dll in c# Code?
I can’t find such Property in the PDF-Namespace ?
Maybe if i could set this option the problem is really solved and you don’t have to check my pdf files.

Thanks Mark

Hi,

the option is called PDFGeneralAutorotate (0=none, 1=all and 2 = single page).

regards,

Robin

Hello Robin,

but this option seems not to be documentated ? I can’t find it in the docuentation of the pdfforge plugin. Here is my small c# test code. Maybe you can tell me where to set this option ?

string[] files = new string[] { @“c:\temp\ps\PSFile004.pdf”, @“c:\temp\ps\PSFile005.pdf” };
pdfforge.PDF.PDF pdf = new pdfforge.PDF.PDF();
pdf.MergePDFFiles(ref files,@“c:\temp\GesamtTest.pdf”,false);

Thanks
Mark

Hi,

sorry I somehow got confused on the way and forgot you were using the pdfforge.dll(even though you highlighted it, really sorry) and not the COM object. Unfortunatly you can´t set it in the .dll, we will have a closer look at it though.

regards,

Robin

Robin…I have made calls from vbasic from inside MS excel, and while plodding around, I always wonder if there is documentation of the namespaces as a pdf or on the pdfforge.org site — something that identifies the variables and usage…

thanks…


Hi,

there is a windows help file in the same folder the .dll is stored in.

regards,

Robin


Hi Robin, 


I have tracked down the specific cause of this issue and the solution.  The error lies in the MergePDFFiles function in the pdfforge.PDF.PDF class.

In the function, the rotation of the page is being referenced the same for the 90 and 270 degree rotations.  The rotation value used is for the 90degree turn so in the case of a page that should be rotated 270 degrees it is being rotated only 90 and appears inverted.

   switch (reader.GetPageRotation(num))
          {
            case 90:
->>> problem: AddTemplate function appearing below should be copied up here.
            case 270:
->>> problem: rotation below needs to be changed to correspond to 270 rotation (currently being treated as a 90) 
              directContent.AddTemplate((PdfTemplate) importedPage, 0.0f, -1f, 1f, 0.0f, 0.0f, reader.GetPageSizeWithRotation(num).Height);
              continue;
->>> problem: no code to check/trap for 180 degree rotation.
            default:
              directContent.AddTemplate((PdfTemplate) importedPage, 1f, 0.0f, 0.0f, 1f, 0.0f, 0.0f);
              continue;
          } 

Chris

Hi Chris,

this is fixed in the next version.

Best,