Beiträge von mikeR

    I use metafiles to be drawn on the pdf printer.

    The size of the metafile is always 1122 (Height) and 794 (Width)
    (initilaized through this code: metaFile.Width := MulDiv(PageHeight, 96, 1440);)

    When printing on different computers this gives different page sizes
    in the pdf file. In one case it is correct (297x210mm) on other computers
    it is too small or too big.

    I've here the tags I think are responsible for the width and height of the
    pdf docs:

    Incorrect (on my test computer; 279x215mm):
    /Type/Page
    /Parent 7 0 R
    /Resources 8 0 R
    /MediaBox [0 0 612 792]

    Correct (on my own computer; 297x210mm):
    /Type/Page
    /Parent 7 0 R
    /Resources 8 0 R
    /MediaBox [0 0 598 839]
    /Contents 13 0 R
    /Contents 5 0 R


    We got a workaround for this using

    PDFPrinter.DrawMetafileEx(0, 0,
    round(Metafile.Width / 96 * 72),
    round(Metafile.Height / 96 * 72),
    metaFile.Handle,96,96);

    But I think it's not very clean.

    any help??

    best regards
    Mike

    Sometimes in my project it is necessary to insert a page break so that headers are next to some graphic objects. I know there is ParKeep but this is not sufficient for me. So how can I insert a page break at the current cursor position?

    best regards
    Mike

    I use in my projects this command:

    PrintPageOnCanvas(ToCanvas, outRect, counter, [ppmUseBorders] ,100);

    This method is a member of TWPRichText so take a look at it!

    regards
    Mike

    I just tried to print a mm grid using standard VCL code. It appears that
    using stretched metafiles the grid is 1mm smaller on 10cm which is not sufficient.

    Pherhaps someone has any ideas...

    best regards
    Mike

    I use to print to Canvas method to print a TWPRichText page on a metafile canvas and then print this metafile either to a PDF file or a printer. This eases for us the functionality to provide a mm-Paper on the screen/printer and reduces the lines to be drawn (and there are plenty of them!).

    The only thing is now, how can I preserve that 5mm on the screen is the same as 5mm on the printout. The best I achieved is nearly 5mm but on other systems this method fails.
    Here is the code I use:


    // logx, logy are PixPerInch from the screen

    metaFile.Width := MulDiv( Printer.PageWidth + 2*GetDeviceCaps(Printer.Canvas.Handle, PHYSICALOFFSETX ),
    logx, GetDeviceCaps( Printer.Canvas.Handle, LOGPIXELSX ) );
    metaFile.Height := MulDiv( Printer.PageHeight + 2*GetDeviceCaps(Printer.Canvas.Handle, PHYSICALOFFSETY ),
    logx, GetDeviceCaps( Printer.Canvas.Handle, LOGPIXELSY ) );


    outRect := Rect(-GetDeviceCaps(Printer.Canvas.Handle, PHYSICALOFFSETX ),
    -GetDeviceCaps(Printer.Canvas.Handle, PHYSICALOFFSETY ),
    Printer.PageWidth + GetDeviceCaps(Printer.Canvas.Handle, PHYSICALOFFSETX ),
    Printer.PageHeight + GetDeviceCaps(Printer.Canvas.Handle, PHYSICALOFFSETY) );

    metaFileCanvas := TMetafileCanvas.Create(metaFile, 0);
    try
    WPRichText1.PrintPageOnCanvas(metaFileCanvas, r, counter, [ppmUseEvents, ppmUseBorders] ,100);
    finally
    metaFileCanvas.Free;
    end;

    // Print the metafile to the printer
    Printer.Canvas.StretchDraw(outRect,metaFile);


    Is there something I'm missing??

    regards
    Mike

    I didn't mean the addionaly lines, they do not bother me. I meant the
    rows itself. They look like as if they were merged from two tables
    (the lines between the rows are double the size than lines between columns!!). You can easily test it by opening a html document with a table.

    When opening a html document with the demo editor I must disable the
    upper and lower borders for each second line to get the linewidth corrected (but the spacing is then a little crummy...)

    I there something I could easily do?

    best regards
    Mike

    For our reporting tool we have to insert tables and do this using HTML tables. The thing is that WPTools seem to add for each row a new table and this leads to doubled lines on the output!

    How can this be circumvented?

    best regards
    Mike

    I changed some things and now the footer does not disapear anymore in the pdf. I figured out that some of my components did clip some area and that clipping was the reason for the disapearing footers.

    But one problem is still there: The footer does not disapear any more but the breaking line between document and footer is not visible on the pdf -
    document.

    So what did you mean by changing the reference printer? How can I tell TWPRichText that I want to print a pdf file??

    best regards
    Mike

    Addionaly I will post my printing code:

    We want to have the default cell height to be smaller to get more lines per page. I found three properties regarding paragraphs: CurrAttr.SpaceBetween, CurrAttr.SpaceAfter, CurrAttr.SpaceBefore.
    Are these properties the only one to change a cell height or did I oversee something?

    best regards
    Mike

    I use the same routine to print pdfs (using TWPPDFPrinter) and
    normal documents on a printer. At first I put everything on a Metafile using PrintPageOnCanvas of the TWPRichText object then print it to the printer. The thing is that sometimes the
    footer just disapears (or just the breaking line) and the output of
    footers is different using one time the pdf printer and one time the
    normal printer.

    Any help??

    best regards
    Mike

    My problem is that when printing with custom code and using some sort of right alligned text the text is clipped a few pixels (that comes often when I use Page x/y right alligned in a footer). It does not appear when using a right alligned tab or printing with the built in print routine!

    What must I do to get non clipped printings??

    I use following code to print pages on a metafile and then to a printer