Beiträge von gregsohl

    We are generating PDFs with wPDFControl version 2.94. I'm seeing PDF file sizes 3-4 times larger than we have produced with other products and would like to make sure we are setting options correctly with wPDFControl.

    I have the following constraint:

    1. I am using custom fonts and must make sure that the generated PDF can be properly rendered on systems without those fonts installed.

    Here are the options I am using now:

    Code
    pdfControl.SetLicense(...);
    pdfControl.DefaultSize = wPDF.ePage.Letter;
    pdfControl.FontMode = wPDF.eFontMode.EmbedTTFSubsetUsedChar;
    pdfControl.PDFMode = (wPDF.eDevMode)(eDevMode.ClipRectSupport | eDevMode.AlwaysHighResPDF | eDevMode.ExactTextPositioning);
    pdfControl.PDFOptions = wPDF.ePDFOptions.CreateAutoLinks;
    pdfControl.Thumbnails = wPDF.eThumbnails.Color;
    pdfControl.TextCompression = wPDF.eTextCompression.FastDeflate;

    How do I satisfy my constraint (above) and minimize my PDF size?

    I can submit PDF samples if needed.

    Thanks.

    Greg

    That is correct. In this case the programmer had wrapped the initialization of the PDFControl in a using statement something like this:

    Code
    private void OnInitializePrint()
    {
        using(PdfControl pdfControl = new PdfControl)
        {
            (m_printDocument.PrintController as PdfPrintController).PdfControl = pdfControl;
    
    
            // other initilialization
        }
    }

    So effectively the pdfControl still existed because there was a reference held to it by the member variable m_printDocument. But the PdfControl.Dispose() method had been called upon exiting the using statement block. This caused the PdfControl.Reference to be cleared, which then led to the error in PdfControl.NeedGraphic (I think that is the method name)

    Thanks Julian.

    Hi,

    I'm getting an exception while generating a PDF. Can you provide any ideas on correcting this? Another developer on my team thought it might be related to the issue described here: http://wpcubed.com/forum/viewtopic.php?=&p=6029

    Versions:
    wPDF.dll - 2.94.2594.20078
    wPDFControl02.dll - 2.9.4.3

    Also, I don't think the source code I have for the .NET wrapper matches this version. Can you forward the correct source for the wrapper to me please? Tell me if you can't get my email from my forum registration and I'll send an email.

    Here is the callstack from the exception:

    Code
    at System.Drawing.Imaging.Metafile..ctor(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, String desc)
       at wPDF.PDFControl.NeedGraphic()
       at wPDF.PDFControl.StartGraphic()
       at wPDF.PDFControl.StartPage(Int32 w, Int32 h, Boolean landscape)
       at Fiserv.ASNET.Printing.PdfPrintController.OnStartPage(PrintDocument document, PrintPageEventArgs e)
       at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
       at System.Drawing.Printing.PrintController.Print(PrintDocument document)
       at System.Drawing.Printing.PrintDocument.Print()
       at Infragistics.Win.UltraWinGrid.UltraGrid.Print(UltraGridLayout layout, PrintDocument printDocument, RowPropertyCategories retainRowPropertyCategories)
    ...

    Can you please point me to the version history documentation? Specifically, I'd like to know what changed in the wPDFControl02.DLL and wPDF.DLL between version 2.6.1.3 and 2.9.4.3? In early testing, I'm seeing performance improvements and PDF size reduction.

    I really need to know if the multi-threading issues in 2.6.1.3 resolved?

    Thanks.

    Greg

    ... and in my last multi-threaded test run, the following exception:

    Code
    Object reference not set to an instance of an object.
       at wPDF.wPDFControlDLL.DrawMetafile(Int32 env, IntPtr meta, Int32 x, Int32 y, Int32 w, Int32 h, Int32 xres, Int32 yres)
       at wPDF.wPDFControlWrap.DrawMetafile(Int32 env, IntPtr meta, Int32 x, Int32 y, Int32 w, Int32 h, Int32 xres, Int32 yres)
       at wPDF.PDFControl.CloseCanvas()
       at wPDF.PDFControl.EndPage()
       at MyNamespace.PdfPrintController.OnEndPage(PrintDocument document, PrintPageEventArgs e) in D:\mysource\PdfPrintController.cs:line 48
       at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
       at System.Drawing.Printing.PrintController.Print(PrintDocument document)
       at System.Drawing.Printing.PrintDocument.Print()
       at MyNamespace.PrintIdentifiersPDF.Print() in d:\mysource\printidentifierspdf.cs:line 117

    When I'm using it in a multi-threaded environment, with multiple PDF's being generated at once, each thread with its own instance of the .NET wrapper class, I'm getting occasional exceptions which I'm having trouble finding any reason for. The exception is:

    Code
    Object reference not set to an instance of an object.
       at wPDF.wPDFControlDLL.EndPage(Int32 env)
       at wPDF.wPDFControlWrap.EndPage(Int32 env)
       at wPDF.PDFControl.EndPage()
       at Mynamespace.Printing.PdfPrintController.OnEndPage(PrintDocument document, PrintPageEventArgs e)
       at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
       at System.Drawing.Printing.PrintController.Print(PrintDocument document)
       at System.Drawing.Printing.PrintDocument.Print()
       at Mynamespace.PrintIdentifiersPDF.Print()

    Any ideas what would cause this? I've never had this happen in a single threaded use. Thanks.

    How about the ActiveX Control itself when used via the .NET wrapper? The documentation for the ActiveX control says:

    "Plaese note that the DLL can currently not work multithreaded."

    Greg

    I'm having some difficulty getting the drawing coordinates measured correctly when attempting to draw to the PDFControl.Canvas. The PageUnits show they are set to GraphicsUnits.Display which is documented as 1/75th of an inch. I've attempted to adjust my coordinates based on this without success. I've also changes the PageUnits to GraphicsUnits.Inch and had similar results - everything is off by about 20%.

    Is there some additional piece of information I need to know to get this correct? Here is a sample of code where I'm simply drawing an X from corner to corner of an 8.5x11 page (note the printer page bounds are always delivered in 1/100 of an inch:

    private void OnPrintPDFPage(object sender, PrintPageEventArgs e)
    {
    pdfControl1.DrawMetafile(tern1.TerPageMetafile(m_iPrint_Page),300,300); // TerPageMetafile creates pages in 1/300 inches resolution

    // Draw a big X on the page
    Graphics gr = pdfControl1.Canvas;

    float left, right, top, bottom;

    left = ((float)e.PageBounds.Left) * (float)0.75;
    right = ((float)e.PageBounds.Right) * (float)0.75;
    top = ((float) e.PageBounds.Top) * (float)0.75;
    bottom = ((float) e.PageBounds.Bottom) * (float)0.75;

    gr.DrawLine(new Pen(new SolidBrush(Color.Black), (float)0), new PointF(left, top), new PointF(right, bottom));
    gr.DrawLine(new Pen(new SolidBrush(Color.Black), (float)0), new PointF(right, top), new PointF(left, bottom));

    The right and bottom always come out beyond the 8.5x11 edges. Any help is appreciated while I still have some hair left.

    Thanks.

    Do you have any guidelines for accounting for physical printer margins when creating a PDF? Many laser printers can't print to the outer 1/4 inch of the paper. I know that Acrobat Reader can scale when printing a document to account for this, however I'd like to account for it somewhat generally when creating my PDFs to avoid having the entire document scaled down when printed.

    Do you think assuming a outer margin of 1/4 inch is reasonable?

    I've sent the RTF (for reference), the EMF and the PDF in an email with a subject matching this topic. Thank you for your assistance.

    I'm in the process of integrating this in an application and have a rapidly approaching due date. Any expidition of this request will be greatly appreciated. Thanks again.

    I'm using the .NET PDF control to render a metafile generated by the TE Edit Control (from Sub Systems). The documents I'm rendering typically have tables with solid single-line borders. When the control creates the PDF, the borders come out dotted or dashed, I can't really tell which, but definitely not solid.

    I've saved the EMF file generated by the TE Edit Control and viewed it. The borders appear correctly in the EMF file.

    Are there any known issues with table borders? Any ideas?

    Thanks.

    I'm using the wPDF Control in .NET. I'm having a problem using Canvas.DrawString along with DrawMetafile. I want to overlay some text after the metafile has been rendered.

    If I do:

    Code
    pdfControl1.StartPage(wPDF.ePage.Letter, false);pdfControl1.DrawMetafile(tern1.TerPageMetafile(page),300,300);pdfControl1.Canvas.DrawString("Hello World",new Font("Comic Sans MS", 24),new SolidBrush(Color.Black),40, 50);pdfControl1.EndPage();

    the text from the drawstring is never rendered.

    If I do a simple:

    Code
    pdfControl1.StartPage(wPDF.ePage.Letter, false);
    pdfControl1.Canvas.DrawString("Hello World",new Font("Comic Sans MS", 24),new SolidBrush(Color.Black),40, 50);
    pdfControl1.EndPage();

    the text is is rendered just fine on a blank page.

    Any ideas as to why the disconnect here? Is there something I need to do differently or a property I need to change?

    Thanks.