You are not logged in.
Pages: 1
I am using 1.8.8 and have a problem with user defined page sizes.
I sometimes need to generate landscape PDF files. Previously (with another PDF tool) I set the page to A4, then read the width and height, and swapped these using the user defined page size.
The problem I have is that the size of the page does not appear to work properly.
I created a PdfDocumentGDI, set DefaultPageSize to psA4 and then read DefaultPageWidth and height.
I added a page with AddPage and read the VCLCanvasSize. Width=595, height=842
I then draw a line on the VCLCanvas from 10,10 to (width-10,Height-10) which draws a short line which ends in the middle of the page.
If I draw a line from 10,10 to 790,1120 then this draws from top left to bottom right on the page.
Why do I not get the correct width/height values from the VCLCanvas or from the page/document ?
How do I get the drawing limits I can use to draw on the page ?
I tried setting the default values but this also does not always seem to work. I seem to be able to set then to larger values but swapping width and height does not seem to work.
I may just be missing something. I have spent some time trying to figure out how to use the PDF engine. I still have not managed to get the non-VCLCanvas version to work. I looked at all the forum posts and learned a lot from them but I would appreciate a few very simple examples of how best to put text and an image on a PDF page using the different modes available in PDF Engine. I am sure that such examples would also help others get started with the PDF engine.
Thanks.
Offline
About page sizing, the VCLCanvasSize content is created in TPdfPageGDI.CreateVCLMetaFile, when the VCLCanvas is first accessed:
procedure TPdfPageGDI.CreateVCLMetaFile;
begin
fVCLCanvasSize.cx := MulDiv(PageHeight,FDoc.FScreenLogPixels,72);
fVCLCanvasSize.cy := MulDiv(PageWidth,FDoc.FScreenLogPixels,72);
....
So if you call VCLCanvasSize before using VCLCanvas, you'll get the former size.
Could you post your code here? It's sometimes easier to understand for me, than plain English.
What's wrong with the VCLCanvas?
I suspect you don't like it if you use a lot of bitmaps in your pages. There could be some overhead here.
Could you post your code here, then we'll make it work and use it as reference examples?
Offline
Pages: 1