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

Easy-to-use PDF software

review-platform review-platform review-platform review-platform review-platform

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

PDF documents can be cumbersome to edit, especially when you need to change the text or sign a form. However, working with PDFs is made beyond-easy and highly productive with the right tool.

How to Write On PDF with minimal effort on your side:

  1. Add the document you want to edit — choose any convenient way to do so.
  2. Type, replace, or delete text anywhere in your PDF.
  3. Improve your text’s clarity by annotating it: add sticky notes, comments, or text blogs; black out or highlight the text.
  4. Add fillable fields (name, date, signature, formulas, etc.) to collect information or signatures from the receiving parties quickly.
  5. Assign each field to a specific recipient and set the filling order as you Write On PDF.
  6. Prevent third parties from claiming credit for your document by adding a watermark.
  7. Password-protect your PDF with sensitive information.
  8. Notarize documents online or submit your reports.
  9. Save the completed document in any format you need.

The solution offers a vast space for experiments. Give it a try now and see for yourself. Write On PDF with ease and take advantage of the whole suite of editing features.

Customers love our service for intuitive functionality



46 votes

Write on PDF: All You Need to Know

Click the Action drop down next to Action Add to: Selected item Include in: File Include from: Web page Edit this document to choose the action Click the Save button. This creates a link to the document that contains the selected item.