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 (ji****@online.microsoft.com, 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:
ms****@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.