Fuzzy PDF display with GdViewer

Discussions about document viewing.
Post Reply
btesch
Posts: 24
Joined: Thu Jun 23, 2011 10:08 pm
Location: Kansas, USA

Fuzzy PDF display with GdViewer

Post by btesch » Fri Jun 24, 2011 4:24 pm

I am new to GdPicture, and PDF creation, so please be patient. I have added a GdViewer control to my app to view PDFs I am creating with GdPicture. I finally have the creation working for the first part of my project but my problem seems to arise with the viewer. When I open the file with GdViewer it appears a little fuzzy/distorted around the edges of the printed letters. The problem persists when I print the PDF using GdViewer. When I open the same file with Adobe Reader, it is much more clear and prints much cleaner. I am sure I am missing something so any help is appreciated.

I have attached screen shot of the difference. Adobe on top, GdViewer on the bottom.

below is the current code i am using to grab the file and print it.

The forcing of the PDF render setting is an attempt to clean things up, but has not shown as much help.

Code: Select all

            string prtfile = BuildPDF(_agtraxprogram, _filename);
            GdViewer printViewer = new GdViewer();
            printViewer.Visible = false;
            printViewer.CloseDocument();
            printViewer.DisplayFromFile(prtfile);
            printViewer.PrintSetDocumentName(prtfile);
            printViewer.PrintSetShowPrintingProgress(true);
            printViewer.PrintForcePdfDpiRendering(75);
            
            printViewer.PrintDialogFit(this);
            printViewer.CloseDocument();
            printViewer.Dispose();
Attachments
GdViewerAdobeCompare.PNG

btesch
Posts: 24
Joined: Thu Jun 23, 2011 10:08 pm
Location: Kansas, USA

Re: Fuzzy PDF display with GdViewer

Post by btesch » Wed Jul 06, 2011 4:29 pm

Has anyone had a chance to look at this issue?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Fuzzy PDF display with GdViewer

Post by Loïc » Fri Jul 08, 2011 1:58 pm

Hi Bob,

We do not use the same rasterizer engine as Adobe, Adobe send PS content to printer when GdPicture have to send vector data.
We are aware that we don't produce the same output quality than Adobe. Like all our competitors...
Anyway, we do lot of research & make efforts to improve our rendering engine in each release cycles (including minor releases).

This is all I can tell for the moment.

Kind regards,

Loïc

btesch
Posts: 24
Joined: Thu Jun 23, 2011 10:08 pm
Location: Kansas, USA

Re: Fuzzy PDF display with GdViewer

Post by btesch » Fri Jul 08, 2011 3:19 pm

Is part of this the rasterizing when it is created?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Fuzzy PDF display with GdViewer

Post by Loïc » Fri Jul 08, 2011 4:33 pm

I don't understand the question.

btesch
Posts: 24
Joined: Thu Jun 23, 2011 10:08 pm
Location: Kansas, USA

Re: Fuzzy PDF display with GdViewer

Post by btesch » Fri Jul 08, 2011 4:46 pm

Is there anything I can do in my code while creating the PDF that will help? I am using the PDF plugin, do I need to create it as an image (TIFF?) and then save it out as a PDF when I am done? I am just looking to see if I can help with the process from my side.

Thanks,

Bob

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Fuzzy PDF display with GdViewer

Post by Loïc » Fri Jul 08, 2011 5:07 pm

OK Bob I think I misunderstood the initial issue.

Unfortunately your code show anything that can help.

What is the problem ? What are your trying to do ? Creating a PDF from scratch ? drawing text on a new PDF ?
Any explanation is welcome because I don't understand what you are trying to do & what your screenshot shows.

Kind regards,


Loïc

btesch
Posts: 24
Joined: Thu Jun 23, 2011 10:08 pm
Location: Kansas, USA

Re: Fuzzy PDF display with GdViewer

Post by btesch » Fri Jul 08, 2011 5:21 pm

I am creating a PDF from scratch. We get lines of report data back from a UNIX system and then build a PDF version of the report that is to be a mirror of the UNIX generated report, but in PDF format on Windows. Below is the module that takes the reports lines and builds the PDF and then saves it to disk.

Code: Select all

        #region .     LoadPdfPage     .
        private void LoadPdfPage(string filename, string publishedfile)
        {
            //start GdPicture image object
            GdPictureImaging oGdPictureImaging = new GdPictureImaging();
            oGdPictureImaging.SetLicenseNumberUpgrade(Statics.GdPictureLicense(), "XXX");
            GdPicturePDF oGdPicturePDF = new GdPicturePDF();

            string FontCourierStd = string.Empty;
            string FontCourierStdBold = string.Empty;

            oGdPicturePDF.NewPDF(false);
            oGdPicturePDF.SetAuthor("TraxView TraxReports");
            oGdPicturePDF.SetTitle(_agtraxprogram + " - " + filename);
            oGdPicturePDF.SetProducer("AgTrax Technologies");
            oGdPicturePDF.SetSubject(_agtraxprogram + " - " + filename);
            oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch);

            if (parentControl != null)
            {
                parentControl.filescreated.Add(publishedfile);
            }
            if (parentForm != null)
            {
                parentForm.filescreated.Add(publishedfile);
            }

            FontCourierStd = oGdPicturePDF.AddStandardFont(PdfStandardFont.Courier);
            FontCourierStdBold = oGdPicturePDF.AddStandardFont(PdfStandardFont.CourierBold);

            oGdPicturePDF.NewPage(8.5F, 11F);
            oGdPicturePDF.SetTextMode(PdfTextMode.PdfTextModeFill);

            float currentline = 64;
            string currentFont = string.Empty;

            if (_fontsize == 7)
            {
                currentFont = FontCourierStd;
                oGdPicturePDF.SetTextSize(7F);
            }
            else
            {
                currentFont = FontCourierStd;
                oGdPicturePDF.SetTextSize(12F);
            }
            oGdPicturePDF.SetTextMode(PdfTextMode.PdfTextModeFill);

            foreach (TraxView.AgTrax.Trrpt rptline in reportlines)
            {
                float currentlinepos = currentline / 6;
                int linelength = rptline.Trfline.Length;
                switch (rptline.Trftype)
                {
                    case 1:
                        oGdPicturePDF.SetFillColor(0, 0, 0);
                        oGdPicturePDF.DrawText(currentFont, .12F, currentlinepos, rptline.Trfline);
                        break;

                    case 3:
                        oGdPicturePDF.SetFillColor(0, 0, 0);
                        oGdPicturePDF.DrawText(currentFont, .12F, currentlinepos, rptline.Trfline);
                        break;

                    case 5:
                        oGdPicturePDF.SetFillColor(0, 0, 0);
                        oGdPicturePDF.DrawText(currentFont, .12F, currentlinepos, rptline.Trfline);
                        break;

                    case 6:
                        oGdPicturePDF.SetFillColor(0, 0, 0);
                        oGdPicturePDF.DrawText(currentFont, .12F, currentlinepos, rptline.Trfline);
                        break;

                    case 7:
                        oGdPicturePDF.SetFillColor(0, 0, 0);
                        oGdPicturePDF.DrawText(currentFont, .12F, currentlinepos, rptline.Trfline);
                        break;

                    case 16:
                        oGdPicturePDF.SetFillColor(0, 0, 0);
                        oGdPicturePDF.DrawText(currentFont, .12F, currentlinepos, rptline.Trfline);
                        break;

                    case 18:
                        oGdPicturePDF.SetFillColor(0, 0, 0);
                        oGdPicturePDF.DrawText(currentFont, .12F, currentlinepos, rptline.Trfline);
                        break;

                    default:
                        oGdPicturePDF.SetFillColor(0, 0, 0);
                        oGdPicturePDF.DrawText(currentFont, .12F, currentlinepos, rptline.Trfline);
                        break;
                }
                currentline = currentline - 1;
            }
            oGdPicturePDF.SaveToFile(publishedfile);
            oGdPicturePDF.CloseDocument();
            gdViewer.CloseDocument();
            gdViewer.ZoomMode = GdPicture.ViewerZoomMode.ZoomModeWidthViewer;
            gdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter;
            gdViewer.DisplayFromFile(publishedfile);
        }
        #endregion .     LoadPdfPage     .
At this point we are very basic.

Thanks,

Bob

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Fuzzy PDF display with GdViewer

Post by Loïc » Fri Jul 08, 2011 5:26 pm

OK Bob,

But now what is the problem ??

Do you mean that the generated PDF doesn't looks like you expect in Adobe Reader ?
What your initial screenshot shows ?

Loïc

btesch
Posts: 24
Joined: Thu Jun 23, 2011 10:08 pm
Location: Kansas, USA

Re: Fuzzy PDF display with GdViewer

Post by btesch » Fri Jul 08, 2011 5:29 pm

It is still fuzzy even in Adobe reader, just not as bad. Is there anything I can do to make it even cleaner? Just asking to make sure I have not missed something I can do to make the best quality PDF with your tools.

Bob

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Fuzzy PDF display with GdViewer

Post by Loïc » Fri Jul 08, 2011 6:00 pm

Well I think you should try to use another font.
Could you attach an example of PDF you generated ?

btesch
Posts: 24
Joined: Thu Jun 23, 2011 10:08 pm
Location: Kansas, USA

Re: Fuzzy PDF display with GdViewer

Post by btesch » Fri Jul 08, 2011 6:15 pm

The zip file is attached. I had this issue also when using the TrueType "Courier New" font. I have to have a fixed width font. That is required by application format rules for these reports so columns align properly. If you have any suggestions for fonts, I am open to ideas.

Thanks,

Bob
Attachments
TR_AR362P_07082011110552Page1.zip
(2.12 KiB) Downloaded 377 times

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Fuzzy PDF display with GdViewer

Post by Loïc » Fri Jul 08, 2011 6:32 pm

The PDF looks perfect in both Adobe reader and GdViewer.
I don't know what do you mean by "fuzzy", but is the font is not sexy enough for you, just use another one.
I think you can google "fixed font" to get a list of available font and try to use one of them.

Hope this helps!

Loïc

Tom Moran
Posts: 102
Joined: Thu May 24, 2007 9:41 am
Location: Phoenix, Arizona

Re: Fuzzy PDF display with GdViewer

Post by Tom Moran » Sun Jul 10, 2011 5:32 pm

Hi Bob;

DejaVu Sans Mono is a good alternative to Courier New for mono spaced fonts. Also Lucida Console.

Attached is an image comparing the three.

Tom
Attachments
monofonts.jpg

btesch
Posts: 24
Joined: Thu Jun 23, 2011 10:08 pm
Location: Kansas, USA

Re: Fuzzy PDF display with GdViewer

Post by btesch » Mon Jul 11, 2011 3:05 pm

Thanks Tom. I'll give those a try.

Bob

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest