Printing help

C

cj2

I need to create a cover letter in VB. It will have a customers account
number at the top and be addressed to them by name for example (Dear Mr.
Smith). After this it will be the same text for each customer.

This letter is a reminder to pay an invoice and it needs to be merged in
front of an existing pdf document which is the unpaid invoice the
customer was sent previously. The result of the merger of this reminder
letter and the unpaid invoice will be a pdf file that is sent on cd to a
company that does our actual printing and mailing for us.

So again it goes like this
new letter + existing pdf = new pdf which consists of the letter as the
first page followed by 1 or more pages that were part of the old pdf.

One more caveat, the cover letter needs a small line about one inch long
printed on it about 3/4 of an inch down along the right side of the
page. This is a mark used by the folding and stuffing equipment to know
where one mailing is finished and another starts.

It's been suggested I can somehow get VB to use word to do this. I can
easily create a template letter in using Word and even include the
needed line I think if VB can feed it the account number and name. How
do I do this? How do I handle the merging of the documents? Is this
possible? Can anyone point me to any help?

Thanks,
CJ
 
J

Jialiang Ge [MSFT]

Hello CJ,

If the program is required to be designed as new letter + existing pdf =
new pdf, we need to turn to some third party libraries or open source
components (e.g. Gillard's links) for help because Microsoft does not have
component to read&edit an existing pdf file.

But if the program can be designed as new letter + existing doc(x) template
= new pdf, we can implement it with VB.NET + Microsoft Word 2007 (note:
Microsoft Word 2003 and the previous do not have the function in its object
model to export a document to pdf. This feature is new to Word 2007). Here
is a step list of implementation for your reference.

Step1. Create a Word document with a bookmark "DearTitle" in the first
line, followed by the same text for each customer.

Step2. Regarding your request of a small line along the right side of the
page, I think we can place a Word line shape at the right position, and set
is Text Wrapping to "In front of text" so that the line has a fixed
position and does not interfere with the document body.

Step3. Save the document as a Word template (dotx)

Step4. Create a new VB.NET project in Visual Studio, prepare for Word
automation, and write code to create a new document based on the dotx in
step3.
http://support.microsoft.com/kb/316383/en-us
oWord.Documents.Add "<Path to your template>\MyTemplate.dot"

Step5. Automate Word to set the bookmark "DearTitle"'s text as customers'
name ("Dear Mr. Smith")
http://support.microsoft.com/kb/316383/en-us
oDoc.Bookmarks.Item("DearTitle").Range.Text = "Dear Mr. Smith"

Step6. Export the document to pdf
oDoc.ExportAsFixedFormat("d:\result.pdf",
Word.WdExportFormat.wdExportFormatPDF)

CJ, please let me know whether this step list is helpful to you or not. If
you have any other questions or concerns, DON'T hesitate to tell me.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

cj2

I've been put on another project for a few day. You understand
correctly what I wanted to do. I have a third-party com component that
will append a pdf to another pdf so I can use that. We had hoped to
avoid using it. Still a co-worker insists that Word will do this. When
I get back on this project (probably next week) I'll insist he prove it
to me.
 
C

cj2

Hi Jialiang Ge,

I have finally started back to work on this project. As you suggested I
am using a template for the letter and can fill it using VB to create
each customers letter.

For attaching a copy of the customers last invoice. I decided to try
this in Word w/o using VB to see if it is possible first. I don't need
to edit the invoice--just attach it. With the template letter opened in
word I went to the bottom and put a hard return to get me at the top of
page 2. I went to insert/object/Adobe Acrobat Document then pointed it
to an invoice. It did put the invoice into the word document on page 2
and I can save this combined document as a pdf. This is technically
what I want to do using VB. However the problem I found was when the
pdf was inserted into the word document it shows much smaller than it
really is. If I right click the inserted pdf invoice it in word and
choose Format Object/Size it reports it as 8.25" high and 6.38" wide.
If I open pdf invoice in adobe and check in the print properties it
shows it as 11" high and 8.5" wide. I can't seem to get word to insert
it at the same size/resolution as it is viewed and printed using Adobe.
If I try to stretch it in word it gets very blurry. Do you have any
idea how to insert it and have it remain full size. If I can get this
figured out I'm sure I can automate it in VB.

Thanks for your help.
CJ
 
C

cj2

:( I just found out it's only inserting the first page of the invoice
pdf. My invoice pdfs many times have 2 or 3 pages. I guess I'll need
that figured out too.

Maybe I'll have to return to a 3rd party control to append the invoice
to the collections letter after all.

Any ideas?
 
J

Jialiang Ge [MSFT]

Hello CJ,

The component "Adobe Acrobat Document" in the Insert/Object dialog was
designed&developed by Adobe. It inserts a PDF file as an object in Word,
but you will only see the top page by design. If a change of this behavior
is necessary, we may need to contact Adobe's support
http://www.adobe.com/support/.

Word does not have any built-in function to import the complete pdf content
to a document. There are 3rd party utilities that can separate the PDF
pages as individual graphics to be inserted into Word, but this may be not
better than your current solution -- a 3rd party control to append the
invoice.

P.S. I think I still had some misunderstanding at the beginning of this
thread. I did not assume that you have to import an existing pdf to a word
document, so I suggested automating Word.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top