Add Digital Signatures and Linearization to PDF files with VeryPDF PDF Digital Signature API

Introducing VeryPDF PDF Digital Signature API: The Ultimate Tool for PDF Digital Signatures.

Digital signatures are a secure and reliable way to authenticate electronic documents. They ensure the authenticity and integrity of the document and protect it from any unauthorized modifications. VeryPDF PDF Digital Signature API is a powerful tool that allows developers to add digital signatures to PDF files programmatically. In this article, we will introduce you to this tool and highlight its features and benefits.

image

What is VeryPDF PDF Digital Signature API?

VeryPDF PDF Digital Signature API is a software development kit (SDK) that allows developers to add digital signatures to PDF files programmatically. This API provides a simple and easy-to-use interface that can be integrated into various programming languages such as C++, C#, VB.NET, and Java. It supports PFX file and can linearize PDF files for fast web view.

Features and Benefits for VeryPDF PDF Digital Signature API:

1. Digital Signature: With VeryPDF PDF Digital Signature API, you can add digital signatures to PDF files easily and securely. You can customize the signature appearance, including the location, size, and color of the signature.

2. PFX File Support: The API supports PFX file, which is a secure and portable format for storing private keys and digital certificates. This feature makes it easy to manage and secure digital signatures.

3. PDF Linearization: VeryPDF PDF Digital Signature API can also linearize PDF files for fast web view. Linearization is a process that optimizes the PDF file for web viewing, making it faster to load and view on the internet.

4. Easy to Use: The API provides a simple and easy-to-use interface that can be integrated into various programming languages. You can customize the signature settings and add digital signatures to PDF files with just a few lines of code.

5. Secure: VeryPDF PDF Digital Signature API uses industry-standard encryption algorithms to ensure the security of digital signatures. It also provides options for password protection and certificate validation to further enhance security.

How to Use VeryPDF PDF Digital Signature API?

Using VeryPDF PDF Digital Signature API is straightforward. Here are the basic steps:

1. Download and install the API on your computer.

2. Create a new project in your programming language and add the API to your project.

3. Load the PDF file that you want to add a digital signature to.

4. Customize the signature settings, including the appearance and location of the signature.

5. Add the digital signature to the PDF file.

6. Save the modified PDF file to the desired location.

VeryPDF PDF Digital Signature API is a powerful and efficient tool that provides developers with an easy and reliable way to add digital signatures to PDF files. Its features such as PFX file support, linearization, and security make it the ultimate tool for PDF digital signatures. With VeryPDF PDF Digital Signature API, you can ensure the authenticity and integrity of your PDF documents easily and securely.

Want to buy this product from VeryPDF?

Should you be interested in acquiring a license for our product or require assistance in developing a custom software solution based on it, please do not hesitate to reach out to us. Our team is always ready to assist you and provide you with the necessary support.

http://support.verypdf.com/

We look forward to the opportunity of working with you and providing developer assistance if required.

C++ example to add Digital Signatures and Linearization to PDF files with VeryPDF PDF Digital Signature API:

#include <stdio.h>
#include <stdlib.h>
#include "VSLibA.h"         /* Use VeryPDF PDF Library */
#include "VSExcept.h"       /* Use Exceptions API */
#include "VSError.h"        /* Use Errors API */
#include "VSDocA.h"         /* Use PDF Document API */
#include "VSAcroFormA.h"    /* Use Acro Objects API */
#include "VSFontA.h"        /* Use Common VeryPDF PDF Routines */
#include "VSTypes.h"
#include "VSDocA.h"
#include "VSExcept.h"
#include "VSError.h" 
#include "VSLibA.h"
#include "VSPageA.h"
#include "VSCanvasA.h"
#include "VSImageA.h"
#include "VSGStateA.h"
#include "VSFontA.h"

int main2( int argc, char* argv[] ) 
{ 
   PDFLibHandle  Lib; 
   PDFDocHandle Doc; 
   ppUns32 ErrorCode; 
   char ErrBuff[200]; 
   ppUns32 Page, ImageIndex, i2; 
   PBXHandle PB; 
   ppUns32 i, Count, w, h, rw, rh; 
   ppReal pw; 
   TPDFRect R; 
   TPDFColor C; 
   PDFImageHandle IMG; 
   Lib = InitPDFLibrary("",""); 
   PDFTRY(Lib){ 
      //Doc = PDFDocCreate(Lib); 
      Doc = PDFDocLoadFromFile( Lib, "../../data/in/pdf/empty.pdf" );/* Load existing PDF file */
      PDFTRY( Lib ){ 
         PDFDocSetRemoveUnUsed( Doc, false); 
         PDFDocAppendPage2( Doc, psA4, poPagePortrait); 
         //PDFDocAppendSignatureFromFile ( Doc, "Data\In\dig-signature.pfx","Sign", "Test Only...",false, "123456");    
         PDFDocAppendSignatureFromFile( Doc, "../../data/in/other/dig-signature.pfx", "Document Signature", "Only for test...", false, "123456" );
         C.Device = cgGray; 
         C.Color.Gray = 0.5; 
         PDFFontTrueTypeAppend( Doc, "Tahoma", false, false ); 
         R.xl = 0; 
         R.yl = 0; 
         R.xr = 110; 
         R.yr = 110; 
         PB = PDFPagePlaceSignature(Doc, 0, R, 72); 
         PBXSetColor (PB, C); 
         PBXNewPath (PB); 
         PBXMoveTo (PB, 0,0); 
         PBXLineTo (PB, 100, 100); 
         PBXMoveTo (PB, 0, 100); 
         PBXLineTo ( PB, 100, 0 ); 
         PBXStroke (PB); 
         PBXSetActiveFont( PB, 0, 10, false, false); 
         PBXTextOut(PB, 0,0,0,"Test"); 
         PBXClose (PB, false); 
         PDFDocSetAutoLaunch ( Doc, true); 
         PDFDocSaveToFile (Doc, "C:\\TSign.pdf"); 
      } PDFFINALLY (Lib){ 
         PDFDocClose ( Doc); 
      } PDFFINALLYEND (Lib); 
   } PDFFINALLY (Lib){ 
      ErrorCode = PDFLASTERROR( Lib ); /* Check last error, if 0 then finished successfully */ 
      if ( ErrorCode ){ 
         VSGetErrorStr( ErrorCode, ErrBuff ); 
         printf("Error: %sn", ErrBuff); 

      }else { 
         printf("Success...n"); 
      } 
      DonePDFLibrary( &Lib ); 
   } PDFFINALLYEND (Lib); 
   return ErrorCode; 
} 

int main( int argc, char* argv[] )  /* Get PDF filename as first parameter */
{
   PDFLibHandle    PDFLibrary; /* PDF Library Handle */
   PDFDocHandle    Doc = NULL; /* PDF Document Handle */
   ppInt32         ErrorCode;/* Check Error Code */
   char            ErrBuff[256];
   PBXHandle PB; 
   ppUns32 i, Count, w, h, rw, rh; 
   ppReal pw; 
   TPDFRect R; 
   TPDFColor C; 
   int FontIndex;
   int GraphicState;  /* Graphic state index */
   int I;             /* Image index variable */

    PDFLibrary = InitPDFLibrary(NULL, NULL);/* Initialize PDF Library */
    PDFTRY ( PDFLibrary ){
		Doc = PDFDocLoadFromFile( PDFLibrary, "../../data/in/pdf/empty.pdf" );/* Load existing PDF file */
		PDFDocSetLinearized( Doc, false );/* Set non-linearize option for crypted PDF file */

		if ( PDFDocGetPageCount( Doc ) > 0 ) {/* If have one or more pages in source document */
#ifdef WINDOWS_PLATFORM
			PDFDocSetAutoLaunch( Doc, true );   /* Launch destination PDF file after work */
#endif          
			/* Append digital signature from file */
			PDFDocAppendSignatureFromFile( Doc, "../../data/in/other/dig-signature.pfx", "Document Signature", "Only for test...", false, "123456" );

            C.Device = cgGray; 
            C.Color.Gray = 0.5; 
            //PDFFontTrueTypeAppend( Doc, "Tahoma", false, false ); 
            R.xl = 0; 
            R.yl = 0; 
            R.xr = 110; 
            R.yr = 110; 
            PB = PDFPagePlaceSignature(Doc, 0, R, 72); 
            PBXSetColor (PB, C); 
            PBXNewPath (PB); 
            PBXMoveTo (PB, 0,0); 
            PBXLineTo (PB, 100, 100); 
            PBXMoveTo (PB, 0, 100); 
            PBXLineTo ( PB, 100, 0 ); 
            PBXStroke (PB); 
   
            //I = PDFImageAppendToDocFromFile ( Doc, "../../data/In/Images/water.png",  itcJPEG, 0 ); /* Load image and assign image index */
            I = PDFImageAppendToDocFromFile ( Doc, "../../data/In/Images/snow.jpg", itcJPEG, 0 ); /* Load image and assign image index */
            PBXShowImage ( PB, I, 0, 0.0, 110, 110, 0);     /* Insert image into document on the current page slopping 30grad*/
            
            PBXClose (PB, false); 
            PDFDocSetAutoLaunch ( Doc, true); 
   
            PDFDocSaveToFile( Doc, "C:/SignDocTest.pdf" );/* Save destination PDF file as "sign-doc-test.pdf" in current path */
        }
    } PDFFINALLY( PDFLibrary ){/* Do further if haven't PDF Library Exceptions */
        if ( Doc ) PDFDocClose ( Doc );/* Close PDF Document and free memory */
        ErrorCode = PDFLASTERROR( PDFLibrary );/* Check last error, if 0 then finished successfully */
        if ( ErrorCode ){
            VSGetErrorStr( ErrorCode, ErrBuff );
            printf("Error: %s\n", ErrBuff);
        }else {
            printf("Success...\n");
        }
        DonePDFLibrary( &PDFLibrary );/* Free PDF Library */
    } PDFFINALLYEND( PDFLibrary );/* End of try...end block */
    return ErrorCode;/* Return Error Code as program result */
}
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

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!