Overlay 2 PDF documents within a C#/C++ application

Question:Been trying to figure this problem out for quite a while and haven't had much luck. So I have this program that outputs a PDF file (1.3 version). The Outputted PDF is basically a plain text PDF so the idea is to have the user open another PDF which has graphics and have the text PDF overlay the other.However I haven't been able to find any way to do this for C/C++. Is there a API that I could use? Would need to work for both Mac/Windows OS.Any assistance would be greatly appreciated. Is there any solution on VeryPDF?

Answer: According to your needs, maybe you can have a free trial of this software:VeryPDF PDF Toolbox Component for .NET, by which you can overlay PDF from C#. And this software could work under three platforms like Window system, Mac system and Linux system. This is not API, it is COM version software. By it you can also merge PDF, split PDF, remove pages from PDF, fill PDF form, add watermark to PDF, export or edit PDF description information, attach file to PDF, remove attached file from PDF, compress stream objects of PDF, remove PDF passwords, encrypt PDF with password, and repair damaged PDF. Please check more information of this software on homepage, in the following part, let us check how to overlay PDF by this software.

Step 1. Download VeryPDF PDF Toolbox Component for .NET

  • For easy uploading and downloading, we have compressed it to zip file. Here I take the Window version for example. If you need to download other version software, please go to Try and Buy website.
  • When downloading finishes, you need to unzip it then you can call it normally like other COM software.

Step 2. Overlay PDF from C#.

  • Here is the command line version usage, please have a check:pdftoolbox <input files> [options] <-outfile output >
  • When you need to overlay PDF, you may need to use the following parameters:
  • -underlay        : apply the first page of the background PDF to the background of the single input PDF.
    -mulunderlay : apply each page of the background PDF to the background of the corresponding page of the single input PDF.
    -overlay          : use the first page of the background PDF as a watermark and put it over the input PDF.
    -muloverlay   : put each page of the background PDF over the corresponding page of the input PDF.

  • When you need to overlay PDF from C# code, please refer to the following code template:
  • private void button1_Click(object sender, EventArgs e)
    {
        string strExePath =
    System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
                PDFToolBoxCom.PDFToolBoxCom p = new PDFToolBoxCom.PDFToolBoxCom();
                string strReturn = p.RunCMD("sample_in1.pdf -overlay sample_fillform.pdf -outfile "_overlay_out.pdf");
            }

During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in PDF Toolbox Command Line and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!