Report to PDF - Lossy Image quality when converting to PDF (1 Viewer)

dynamode

New member
Local time
Today, 05:11
Joined
Feb 11, 2010
Messages
3
Hi , I have a report that I am converting to PDF using the OutputTo action in a macro.

The report is for A4 viewing by customer to be sent via email later.

The document is a letter so it must have our comany letterhead image at the header. I have created the image in photoshop 300dpi 700px by 133px, so that when inserted into the report in design view is it the correct size without resizing. This image looks fine when viewing the report out of design view.

The problems comes after the report is saved as PDF by the macro command at the file location. When I Open the new PDF the image quality of the header image has degraded quite a lot, it must have been compressed during the process.

Does anyone know a fix or workaround or done in VBA that would prevent the PDF being generated in a "optimised" format. I figure there must be a default level of compression set - which is making my letterhead image coming out with loss of data. ??

Im using Access2007 with the Save as PDF Add in installed.

also
the Output File line in the macro im using is
\\NASDrive\share\clientfolder\TESTING\& [surname]&[Quoteref]&".pdf"
im trying to get it to make the file name to pull data from the surname and quoteref field on the form. Cant get it to work in the macro. What is the correct way to reference it ? ?

any help would be really apreciated
thankss
J
 
Last edited:

vbaInet

AWF VIP
Local time
Today, 12:11
Joined
Jan 22, 2010
Messages
26,374
Use an image editting software to retouch the image. Isn't capable of this. Also, what you see on a pdf document isn't always exactly what it looks like on print. So maybe print it out and see whether the image actually has lost quality.
 

dynamode

New member
Local time
Today, 05:11
Joined
Feb 11, 2010
Messages
3
Use an image editting software to retouch the image. Isn't capable of this. Also, what you see on a pdf document isn't always exactly what it looks like on print. So maybe print it out and see whether the image actually has lost quality.

Hi thanks for the reply,
The document wont be printed out , rather it will be emailed to the client for client to open on pc.
I have just tried saving the image as high quality png, and using that in the report, but it still comes out lossy in the PDF. I'll now try a really big image (500kb size) and size it down in report design view, see if that helps to retain quality.

Is it not capable of saving a file with field-based file name ??
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 12:11
Joined
Sep 12, 2006
Messages
15,613
its a bit of work, but in A2003 etc, I use Stephen Lebans routine to generate pdfs
it means using some code, and a requires a couple of dll's (storage.dll and dynapdf.dll) but works fine.

basically it saves the report as a snapshot (.snp) then generates a .pdf from the snapshot.

Never had a problem with that - You could try that, and see if that looks better.
 

vbaInet

AWF VIP
Local time
Today, 12:11
Joined
Jan 22, 2010
Messages
26,374
You may need to play around with the image to get a low-quality, compressed bmp that still looks good. Transparency isn't supported in image controls. You could also try using an ico image as well.

Is it not capable of saving a file with field-based file name ??
What do you mean?
 

dynamode

New member
Local time
Today, 05:11
Joined
Feb 11, 2010
Messages
3
You may need to play around with the image to get a low-quality, compressed bmp that still looks good. Transparency isn't supported in image controls. You could also try using an ico image as well.


What do you mean?


A filename for the PDF
such as myquote-100210-bloggs.pdf ("myquote-"&[date]&"-"&[surname]&".pdf"

Im using a macro at the moment, is it possible to reference like that in the outputFile line in macro ? Or can this only be acheived in vba code?

With the macro I got it to
1, generate and convert report to PDF
2, Save it to a specified file location
3,Attach and email the PDF to client.

Downfall of macro is:
Cant seem to have "dynamic" file names or folder locations as per values in a form.
Wont be able to attach more than one Doc to the email. - where potentially I will want to send the email with several documents (specified by tick boxed on form "company borchure" , "latest pricelist" , "Offers" etc) along with the customer quotation.
 

vbaInet

AWF VIP
Local time
Today, 12:11
Joined
Jan 22, 2010
Messages
26,374
Oh that. I don't really use macros. I think it can be done but it would be way too tedious to even try. My guess is you're sending your e-mails via Outlook and if that's the case then you need VBA (Outlook Automation). Have a look at the this link for threads that could help.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 12:11
Joined
Sep 12, 2006
Messages
15,613
the code is not too hard - set a reference to MS Outlook
dim a few variables and this sort of thing does it all - ive pared this done maybe a few missing/superfluous variables


Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String
Dim MyBodyText As String
Dim FileAttachment As String
Dim Response As String


Set MyMail = MyOutlook.CreateItem(olMailItem)

MyMail.To = some address
MyMail.CC = copyto
MyMail.Subject = Subjectline
MyMail.Body = MyBodyText
MyMail.Attachments.Add FileAttachment, olByValue, 1, "Attachment"

'MyMail.Send - send without asking
MyMail.display - display and send by hand

CleanUp:
Set MyMail = Nothing
'MyOutlook.Quit - if necessary
Set MyOutlook = Nothing
 

Pyro

Too busy to comment
Local time
Today, 23:11
Joined
Apr 2, 2009
Messages
126
In Access 2k7 VBA, you can set the output quality of a PDF:

Code:
DoCmd.OutputTo acReport, [ReportName], acFormatPDF, [Output File Name],[AutoStart] ,[TemplateFile] ,[Encoding] , [OutputQuality]

You have two options for OutputQuality:
acExportQualityPrint
acExportQualityScreen

I have had the same problem with images in the past, and once set to acExportQualityPrint, the problem is resolved.

I think it defaults to acExportQualityScreen, which would account for the poor image quality you are seeing.

To reproduce this in a macro though, i'm not sure. I don't use macros much.
 

TallMan

Registered User.
Local time
Today, 08:11
Joined
Dec 5, 2008
Messages
239
Pyro,

I am trying to get my report to open in PDF format. I tried using your code above, but did not know what to put when I got to you ["Output file name"].

All I want to do is have the report open in PDF Format so that the associate can print it off. I suppose they can do this with the report but I do not want any minipulation to occur.

my report name is
DD_UNAPPLIED_TAX-LOTS_REPORT


here is what I have so far. Am I on the right track?

PHP:
DoCmd.OutputTo acReport, [DD_UNAPPLIED_TAX-LOTS_REPORT], acFormatPDF
 

ghudson

Registered User.
Local time
Today, 08:11
Joined
Jun 8, 2002
Messages
6,195
Pyro,

I am trying to get my report to open in PDF format. I tried using your code above, but did not know what to put when I got to you ["Output file name"].

All I want to do is have the report open in PDF Format so that the associate can print it off. I suppose they can do this with the report but I do not want any minipulation to occur.

my report name is
DD_UNAPPLIED_TAX-LOTS_REPORT


here is what I have so far. Am I on the right track?

PHP:
DoCmd.OutputTo acReport, [DD_UNAPPLIED_TAX-LOTS_REPORT], acFormatPDF

Output File Name = "X:\Somewhere\YourFile.pdf"

You have to state where you want the pdf saved and what file name.

Also, your code is not complete. This is how it should look...
Code:
DoCmd.OutputTo acReport, [ReportName], acFormatPDF, [Output File Name],[AutoStart] ,[TemplateFile] ,[Encoding] , [OutputQuality]

This only works with Access 2007 and if you have installed the PDF add-in.
 

Pyro

Too busy to comment
Local time
Today, 23:11
Joined
Apr 2, 2009
Messages
126
To expand on what ghudson said, here is an example of how you might export your report as a PDF:

Code:
[COLOR=black]DoCmd.OutputTo acReport, "DD_UNAPPLIED_TAX-LOTS_REPORT", acFormatPDF, "\\NASDrive\share\clientfolder\TESTING\DD_UNAPPLIED_TAX-LOTS_REPORT.PDF", , , , acExportQualityPrint[/COLOR]

Hope that helps.
 

olxx

Registered User.
Local time
Today, 05:11
Joined
Oct 2, 2009
Messages
52
A filename for the PDF
such as myquote-100210-bloggs.pdf ("myquote-"&[date]&"-"&[surname]&".pdf"

Im using a macro at the moment, is it possible to reference like that in the outputFile line in macro ? Or can this only be acheived in vba code?

With the macro I got it to
1, generate and convert report to PDF
2, Save it to a specified file location
3,Attach and email the PDF to client.

Downfall of macro is:
Cant seem to have "dynamic" file names or folder locations as per values in a form.
Wont be able to attach more than one Doc to the email. - where potentially I will want to send the email with several documents (specified by tick boxed on form "company borchure" , "latest pricelist" , "Offers" etc) along with the customer quotation.

Could you share how did "Attach and email the PDF to client" with macro. I´m stuck with it. Using sendobject, the pdf quality is poor and there is no way to tweak it. OutputTo allows to tweak a quality and save pdf, but how can I send it with email? I´m using Outlook Express and there is no automation for it.
 

kingdoz

Registered User.
Local time
Today, 12:11
Joined
Dec 2, 2008
Messages
29
Hi,

Did you ever file a solution to your problem? Im still stuck on this one.
I reasearched alot but seems only way to email a high res PDF is to Save it first on to your hard disk (as you can choose a higher resolution through Access) but then teh problem is that you cant use SendObject afterwards in the macro if you use a dynamic filename for your PDF.
 

olxx

Registered User.
Local time
Today, 05:11
Joined
Oct 2, 2009
Messages
52
Yeah I did. I started using Microsoft Outlook instead of Outlook Express. With that you can easily automate all kinds of stuff. I used VBA to create pdf and save it on HD for archiving reasons. Next sub will open outlook new e-mail message, fills all the fields automatically and attaches the pdf. And it is done with a single click of command button. As far as I know, you can´t do that with Outlook Express. If you´re familiar with VBA I can send you source code, but there is no remarks or comments, so you have to dig it a little.
 

kingdoz

Registered User.
Local time
Today, 12:11
Joined
Dec 2, 2008
Messages
29
Hi,

I am still stuck with this so would appreciate you sending me your code (you can PM me if you want, and just tell me where I shoudl install and tweak it) and I will do the rest :)

Apreciate your help very much..
 

Simon_MT

Registered User.
Local time
Today, 12:11
Joined
Feb 26, 2007
Messages
2,177
Try your logo at 72dpi not 300dpi. This is the standard resolution for most 'low resolution images'. 733 pixels is a rather large image.

Simon
 

kingdoz

Registered User.
Local time
Today, 12:11
Joined
Dec 2, 2008
Messages
29
Hi,
Thanks fr that. I have tried but access still compresses it, even further I'm afraid. Until Access adds an option that you can choose high quality when you send as PDF I think the only way is to write the via and save first, then send from where it saved with same options then delete it. Perhaps someone here knows a freelancer who can do it for me for a charge?
Thanks
 

Simon_MT

Registered User.
Local time
Today, 12:11
Joined
Feb 26, 2007
Messages
2,177
Have you trying the Office 2007 Add that allows you to SaveAs PDF or XPS. I'm assuming it is also available for Office 2010. Apart from the margins being to narrow it did render the image correctly.

Simon
 

tracyjq

New member
Local time
Today, 05:11
Joined
Apr 11, 2012
Messages
1
If you are being confused by the problem that how to convert PDF file to Image, Joboshare PDF to Image Converter will tell you the answer to this question with professional skills. This PDF to Image Converter is Windows compliant and most comfy software to convert identical PDF to Image with super speed and high quality.
PDF to Image Converter is the professional software that can convert PDF to all kinds of image file formats without any quality loss, such as JPG, JPEG, PNG, BMP, PCX, TGA, etc. PDF to Image Converter will make promise for you that it will bring fire-new experience to you. The following guide will show you how to convert PDF to image with powerful PDF to Image Converter.

Step1: Download Joboshare PDF to Image Converter, install and run it. Click “Add” button to add the PDF files you want to covert, or you can click “Add Folder” button to import PDF folder, batch conversion is supported.
Step2: You can set output format and output destination. Then, you must remember to set output folder by clicking the "Browse" button. At the same time, you can preview files added.
Step3: If everything is ok, you can click the "Start" button to start converting PDF to image. It is so easy to convert PDF to image with this free PDF to Image Converter.
 

Users who are viewing this thread

Top Bottom