Hi Loic,
Let's say we have a standard 8.5x11 page.
- Code: Select all
pic_ID=gdpic.createimagefromfile('c:\test.tif')
I want to take the top 2" and save as a pdf, but I want the pdf to be 8.5x11 with white background.
First create a new image with a white background:
- Code: Select all
gdpic.SetVerticalResolution(300)
gdpic.SetHorizontalResolution(300)
pic2_ID=gdpic.CreateNewImage(2550,3300,32,16777215)
gdpic.DrawImage(pic1_ID,0,0,2550,600) 'Draw only 2".
Now I want to save it as a pdf. I want the pdf page to also be 8.5x11 but I don't want the remaining 6.5 inches to be black. I want it to be white.
- Code: Select all
gdpic.PdfNewPdf('c:\test.pdf')
gdpic.pdfSetMeasurementUnits(3)
gdpic.PdfAddImageFromGDpictureImage(pic2_ID)
gdpic.PdfSetPageDimensions(8.5,11)
gdpic.PdfNewPage
gdpic.PdfDrawImage(1,0,0,8.5,11)
gdpic.PdfEndPage
gdpic.PdfSavePdf
If you do this, the background of the pdf is black, not white. There must be an easier way to do this.
Thanks,
Heard