Attached PDF file opening as blank in email

I am creating a PDF file using "PowerPDF from NUance.
I use CDO to create an email sending the PDF as an attachment.
When the recipient opens the email (in gmail or outlook or whatever) it appears blank .

If I take the same PDF, open it and right click and "send email" no
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnBusiness Consultant (Owner)Commented:
The PDF is a graphic, and the recipient may have images turned off (Outlook Default). Have the recipient go into Outlook, Options, Trust Center and allow images. That should work.
Joe Winograd, Fellow&MVEDeveloperCommented:
Hi Dave,
I've had no problems with PDFs created by Nuance's Power PDF Advanced. Also, your attached file opens fine here, and based on your description, it seems that the CDO code is the problem. I suggest posting it here. The first idea that comes to mind is the SMTP server and the SendUsing parameter — are you using the local SMTP service or SMTP over the network? Here's some sample code that may be helpful:

Regards, Joe
DAveB_LDSAuthor Commented:
Using Google SMTP server. See code
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

DAveB_LDSAuthor Commented:
Code attached as per request
Joe Winograd, Fellow&MVEDeveloperCommented:
I need to leave my office now for an hour or so. Will review your code as soon as I return. In the meantime, please clarify this statement of yours:
When the recipient opens the email (in gmail or outlook or whatever) it appears blank .
What appears blank? The email body? The PDF file? Both? If the PDF file is what's blank, how is it being opened from the email? More later, Joe
DAveB_LDSAuthor Commented:
Thank you for your reply.
When you click to open the PDF. The PDF opens but the page is blank. All of the PDF documents are one page.
I have attached a sample.
Joe Winograd, Fellow&MVEDeveloperCommented:
> When you click to open the PDF. The PDF opens but the page is blank.

Where is it opening? In Adobe Reader? In a tab in your browser? If the latter, which browser and which PDF plug-in?

Your CDO code is fine. I changed it slightly to this:
Set objMessage = CreateObject("CDO.Message")
objMessage.Configuration.Fields.Item("") = 2
objMessage.Configuration.Fields.Item("") = ""
objMessage.Configuration.Fields.Item("") = "mypassword"
objMessage.Configuration.Fields.Item("") = ""
objMessage.Configuration.Fields.Item("") = 465
objMessage.Configuration.Fields.Item("") = True
objMessage.Configuration.Fields.Item("") = 1
objMessage.Subject = "test pdf attachment"
objMessage.from = ""
objMessage.To = ""
Attachment1 = "d:\0tempd\expexch-email-0003.pdf"
objMessage.addAttachment Attachment1
objMessage.TextBody = "this is a test email to see if a pdf attachment works via cdo"

Open in new window

I tested sending to both a Gmail account and a Comcast account. I used your PDF file (expexch-email-0003.pdf) as the attachment. The PDF opened fine in both the Gmail and Comcast email web portals; and it also opened fine in the Thunderbird email client (both emails). So there's nothing wrong on the sending side. The problem is on the receiving side. Regards, Joe
DAveB_LDSAuthor Commented:
Thank you.

Did you use my code to send?

I know that it works if I send manually.
Joe Winograd, Fellow&MVEDeveloperCommented:
> Did you use my code to send?

Yes. I used the code in my last post, which is your code with a few minor changes (didn't see a need for the variables). I put that code in a VBS file and ran it.
Joe Winograd, Fellow&MVEDeveloperCommented:
Leaving my office again, this time for several hours. Will check back into the thread as soon as I return to see how you're doing. Regards, Joe
DAveB_LDSAuthor Commented:
I used VBScript to do the process - with the same results.
I changed the process to use the Outlook object instead of CDO and it worked perfectly.

Must have something to do with the CDO object under Windows 7?
Joe Winograd, Fellow&MVEDeveloperCommented:
Please send the email to me — the one where the PDF opens as blank. I'd like to open it on my end to see what happens. EE doesn't allow posting email addresses in threads, so I'll send you a message via the Messaging System with my address.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DAveB_LDSAuthor Commented:
I've abandoned the CDO solution and switched to using Outlook which is working perfectly.
I think the issue must be the CDO process or Windows.
I don't like to use Windows because if you use certain options it prompts on each email. In this case no prompting and no errors. Also catches invalid email addresses.

          Set outobj = CreateObject("Outlook.Application")
          Set mailobj = outobj.CreateItem(0)
            With mailobj
            .To = Recipient
            .Subject = Camper
            .Body = " "
            .Attachments.Add Attachment1
          End With
          Set outobj = Nothing
          Set mailobj = Nothing
DAveB_LDSAuthor Commented:
Good support even though the issue did not occur on his computer.
Joe Winograd, Fellow&MVEDeveloperCommented:
Thanks for the update...and the kind words...really appreciate hearing them! That's a great solution you developed. Regards, Joe
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.