BrianTheLibrarian Posted June 7, 2018 Posted June 7, 2018 Hello I'm using tatietel's PDF UDF. I have 3 different sized images I am trying to put into a PDF and make it so each page is orientated so the image fills up the entire page. I've tested out the sizes and it gets the right size but it doesn't actually change the page size for the pdf. Any idea what I'm doing wrong here or suggestions on how to make it work? If UBound($aImgs)<>1 Then ;=== load resources used in pdf === For $i=1 To UBound($aImgs)-1 _LoadResImage("img"&$i, $aImgs[0] & "\" & $aImgs[$i]) Next ;load each image on it's own page For $i = 1 To UBound($aImgs)-1 $z = $i-1 _getImageSize ($folder&"\preview"&$images[$z]&".png") if ($iY > $iX) Then _SetPaperSize("a4") _SetOrientation($PDF_ORIENTATION_PORTRAIT) EndIf if ($iY < $iX) Then _SetPaperSize("a4") _SetOrientation($PDF_ORIENTATION_LANDSCAPE) EndIf if ($iX = $iY ) Then _SetPaperSize("CUSTOM", 595.276, 595.276) _SetOrientation($PDF_ORIENTATION_LANDSCAPE) EndIf _BeginPage() _InsertImage("img"&$i, 0, 0, _GetPageWidth()/_GetUnit(), _GetPageHeight()/_GetUnit()) _EndPage() Next EndIf
BrianTheLibrarian Posted June 7, 2018 Author Posted June 7, 2018 So while I didn't figure out a solution to the problem, I did a work around. I just went with one page size and scaled the images so that they would fit on each of the page sizes.
dmob Posted June 8, 2018 Posted June 8, 2018 (edited) This works for me; _SetPaperSize("CUSTOM", 841.890, 595.276); A4 landscape _SetOrientation($PDF_ORIENTATION_PORTRAIT) ; even for landscape Edited June 8, 2018 by dmob
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