VeryPDF has release a new version of Advanced PDF Tools SDK today, the new version of Advanced PDF Tools SDK can be downloaded from following web page,
https://www.verypdf.com/app/advanced-pdf-tools/try-and-buy.html#buy-sdk
https://www.verypdf.com/pdfinfoeditor/pdftoolsdk.zip
The new version of pdftoolsdk.dll does support new options to show and hide PDF layers,
-s activelayer=0&&1
-s deactivelayer=0&&1
-s activelayer=0&&1 -s deactivelayer=photo&&text
you can use "&&" symbol to select more layers together.
The following is a C++ example to show and hide layers in PDF file,
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <conio.h>
#include <ctype.h>
#include <windows.h>
/*
-s activelayer=0&&1
-s deactivelayer=0&&1
-s activelayer=0&&1 -s deactivelayer=photo&&text
*/
__declspec(dllexport) int WINAPI VeryPDF_PDFTools(LPCTSTR lpCommand);
void GetModulePath(char *out_path,char *in_name)
{
char *p;
GetModuleFileName(NULL,out_path,256);
p =strrchr(out_path,'\\');
p[1]=0;
strcat(out_path,in_name);
}
void main()
{
char szLayerPDF[_MAX_PATH];
GetModulePath(szLayerPDF, "layers.pdf");
char szOutputPDF1[_MAX_PATH];
GetModulePath(szOutputPDF1, "_out1.pdf");
char szOutputPDF2[_MAX_PATH];
GetModulePath(szOutputPDF2, "_out2.pdf");
char szOutputPDF3[_MAX_PATH];
GetModulePath(szOutputPDF3, "_out3.pdf");
int nRet = 0;
char szCommandLine[1024];
char *lpLicenseKey = "XXXXXXXXXXXXXX";
sprintf(szCommandLine,"pdftools -$ \"%s\" -s \"activelayer=0&&1\" -s \"deactivelayer=photo&&text\" -i \"%s\" -o \"%s\"", lpLicenseKey, szLayerPDF, szOutputPDF1);
nRet = VeryPDF_PDFTools(szCommandLine);
printf("%s\nReturn value is: %d\n\n", szCommandLine, nRet);
sprintf(szCommandLine,"pdftools -$ \"%s\" -s \"activelayer=border\" -s \"deactivelayer=photo&&text\" -i \"%s\" -o \"%s\"", lpLicenseKey, szLayerPDF, szOutputPDF2);
nRet = VeryPDF_PDFTools(szCommandLine);
printf("%s\nReturn value is: %d\n\n", szCommandLine, nRet);
sprintf(szCommandLine,"pdftools -$ \"%s\" -s \"activelayer=text&&photo\" -s \"deactivelayer=0&&1\" -i \"%s\" -o \"%s\"", lpLicenseKey, szLayerPDF, szOutputPDF3);
nRet = VeryPDF_PDFTools(szCommandLine);
printf("%s\nReturn value is: %d\n\n", szCommandLine, nRet);
}
The following is a VBScript code to show and hide layers in PDF file,
Dim nRet, strCmd
Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = fso.GetParentFolderName(wscript.ScriptFullName)
strFolder = strFolder & "\"
strCmd = "pdftools -s ""activelayer=0&&1"" -s ""deactivelayer=photo&&text"""
strCmd = strCmd & " -$ XXXXXXXXXXXXXXX"
strCmd = strCmd & " -i """ & strFolder & "layers.pdf" & """"
strCmd = strCmd & " -o """ & strFolder & "_layers-com-out.pdf" & """"
MsgBox strCmd
Set PDFToolsCOM = CreateObject("PDFTools.PDFToolsCOM")
nRet = PDFToolsCOM.com_VeryPDF_PDFTools(strCmd)
Set PDFToolsCOM = Nothing
The following is original PDF file which contain more layers,
The following is the new PDF file which hide the "border", "text" and "photo" layers,
If you wish show and hide PDF layers and operate PDF files from your application, Advanced PDF Tools SDK will be your best choice, if you have any question for this product, please feel free to let us know,
http://support.verypdf.com/open.php