How Do I Write A Print Driver That Posts A PDF Of A Document To A Url?

Upload and start working with your PDF documents.
No downloads required

How To Write on PDF Online?

Upload & Edit Your PDF Document
Save, Download, Print, and Share
Sign & Make It Legally Binding

How do I write a print driver that posts a PDF of a document to a URL?

I’m not aware of any way to have Word do this out of the box (i.e. a configuration option or setting). You can do it with some macro code like that below, but I’m not aware of any way to enforce usage of the code. The code generates a unique, sequential six digit serial number, stores it in the document’s properties and inserts it into the document header. Subsequent prints will use the serial number stored in the document rather than generating a new number. This approach has some flaws. For example, deleting the file that stores the current serial number will cause the code to generate a new file and start the document numbers over at 1. Deleting the document property that stores the serial number will cause the code to generate a new serial number. A better approach would be to write a Word add-in that does this. Installing the add-in would then enforce usage of the solution. With an add-in I’d store the serial number in a database and use a web service to generate new numbers. Note that the code below is an example that demonstrates the approach, not a complete solution. I’ve not tested it thoroughly, so the code may also contain some bugs. Public WithEvents appWord As Word.Application Private Sub appWord_DocumentBeforePrint(ByVal Doc As Word.Document, Cancel As Boolean) Const PROP_NAME = "DSN" Dim docPrp As Object, docRng As Object On Error Resume Next Set docPrp = Doc.CustomDocumentProperties(PROP_NAME) On Error GoTo 0 If TypeName(docPrp) = "Nothing" Then With Doc.CustomDocumentProperties Set docPrp = .Add(Name.="DSN", LinkToContent.=False, Type.=msoPropertyTypeNumber, Value.=GenerateDSN ) End With End If Set docRng = Doc.Sections.Item(1).Headers(wdHeaderFooterPrimary).Range docRng.Text = docRng.Text & vbNewLine & "Document Serial Number. " & docPrp.Value Set docPrp = Nothing End Sub Function GenerateDSN As Long 'On the next line edit the path to the file that will store the document serial number Const SN_FILE = "c.\users\david\documents\DSN.txt" Const ForWriting = 2 Dim objFSO As Object, objFil As Object Set objFSO = CreateObject("Scripting.FileSystemObject") If Not objFSO.FileExists(SN_FILE) Then Set objFil = objFSO.CreateTextFile(SN_FILE, True) objFil.Write "0" objFil.Close End If Set objFil = objFSO.OpenTextFile(SN_FILE) GenerateDSN = objFil.ReadAll GenerateDSN = GenerateDSN + 1 objFil.Close Set objFil = objFSO.OpenTextFile(SN_FILE, ForWriting) objFil.Write GenerateDSN objFil.Close Set objFil = Nothing Set objFSO = Nothing GenerateDSN = StrZero(GenerateDSN, 6) End Function Function StrZero(strNum As Long, intLen As Integer) As String Dim intTmp As Integer intTmp = Len(strNum) If intTmp < intLen Then StrZero = String(intLen - intTmp, "0") & strNum Else StrZero = strNum End If End Function Private Sub Document_New Set appWord = Application End Sub Private Sub Document_Open Set appWord = Application End Sub

Customers love our service for intuitive functionality

4.5

satisfied

46 votes

Write on PDF: All You Need to Know

Private Sub Word_SaveAs(By Val writer As Object, By Val f As String) If f. Filename = “.docx” Then If Len (By Val f As String) > 1 Then f. Write(writer) Else Word. SaveAs(f. Filename, Writer) End If End Sub Subword_Write(By Val o As Boolean, By Val f As String) Dim o2 As Object, ox As Long Set o2 = Word. LoadDoc(By Val f As String) o. Write o2. Close ox = o2. Columns. Count + 1 For Each ox In ox Set ox = ox. Columns(ox) ox. TextFormat = vocals ox. Offset = ox. Text. Length — 1 ox. Columns(ox). Maximum = 2 End Sub Private Sub Word_Print (By Val printer As Object) If printer. Filename = “.docx” Then Scriptwriter = Object. CreateObject (“Scripting. FileSystemObject”) Scriptwriter. Write \t\t\t” & Verbose End If Set app Word = Application Scriptwriter = printer. Filename app. Visible = True app.VisibleWrite ox If.

What Our Customers Say

Deborah W.
Deborah W.
I corrected a mistake in my form and replaced it with the right information. It took a few minutes only! Thanks a lot!
James S.
James S.
The process of PDF correction has never been so easy. I’ve managed to create a new document faster than ever before!
William G.
William G.
It was really easy to fill out my PDF document and add a signature to it! This is a great service! I recommend it to you!
Denis B.
Denis B.
I edited the document with my mobile phone. It was fast and, as a result, I’ve got a professional-looking document.

Supporting Forms

Submit important papers on the go with the number one online document management solution. Use our web-based app to edit your PDFs without effort. We provide our customers with an array of up-to-date tools accessible from any Internet-connected device. Upload your PDF document to the editor. Browse for a file on your device or add it from an online location. Insert text, images, fillable fields, add or remove pages, sign your PDFs electronically, all without leaving your desk.