pdfstamp command line

veryAddTextEx questions

Hello VeryPDF Support,

Is it possible to set the backcolor of a text stamp?  We have an instance where the desired font color is black and the entire document is redacted making it black as well, so the stamp is not visible (please see “black.pdf”).

In another instance, we have seen unusually large stamp on an image (please see “zoom.pdf”).  Is there a setting to alleviate this from happening?   We’re using veryAddTextEx().
Thank you!
===========================
>>Is it possible to set the backcolor of a text stamp?  We have an instance where the
>>desired font color is black and the entire document is redacted making it black as
>>well, so the stamp is not visible (please see “black.pdf”).

You can use following code to stamp your PDF file, please refer to an example "black-out.pdf" file in attachment, this PDF file is stamped by following code, if you wish hide this text, you can simple set font color to black, then you will not able to see the text stamp,

~~~~~~~~~~~~~~~~
 id=oTest.veryOpenEx(strInPDF, strOutPDF)
 if id>0 then
  '% Every even page%
  'oTest.verySetFunctionEx id, 131, -2, -2, 0,0
 
  oTest.veryAddTextEx id, 2, _
      "This is a test.", _
      2666666,17, _
      0,200,0,0, _
      0, _
      0,0,32, _
      0,0,0
  oTest.veryCloseEx id
~~~~~~~~~~~~~~~~

>>In another instance, we have seen unusually large stamp on an image (please see “zoom.pdf”). 
>>Is there a setting to alleviate this from happening?   We’re using veryAddTextEx().

This is because the paper size in your PDF file is too small, please reduce the font size to 10 or 5 to try again, then you will able to stamp this PDF file correctly.

VeryPDF

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

split a PDF by the bookmarks and name the new files using the bookmarks

We are interested in your product, however I have a question. Is it possible to split a PDF by the bookmarks and name the new files using the bookmarks?
=============================
You can use "bookmark" or "bookmark2" option to name the output PDF files,

bookmark    : split PDF file by bookmarks, append page number to filenames
bookmark2   : split PDF file by bookmarks, without page number in filenames

for example,

"C:\Program Files\VeryPDF PDF Split-Merge v3.0\pdfpg.exe" bookmark C:\A.pdf C:\split
"C:\Program Files\VeryPDF PDF Split-Merge v3.0\pdfpg.exe" bookmark2 C:\A.pdf C:\
"C:\Program Files\VeryPDF PDF Split-Merge v3.0\pdfpg.exe" bookmark2 C:\A.pdf C:\out\

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
spool file page counter sdk

Counting the exact number of pages in any PDF document

Counting the exact number of pages in any PDF document

'-----------------------------------------------------------------
' IF you have ability then for PDF 1.3 version also
' Open file  pdf in binarymode
' Read last 50 lines of that file
' In between somewhere u will find a line
'   "/count xx" pages the xx is # of pages

'MADE ON 14TH AUG 06
'-----------------------------------------------------------------------
' open the PDF  in binary mode & count the pages
' search for "/N  xx"
'             or "/Count xx"

Public Sub pagecount(sfilename As String)
On Error GoTo a
Dim nFileNum As Integer
Dim s As String
Dim c As Integer
Dim pos, pos1 As Integer
pos = 0
pos1 = 0
c = 0
' Get an available file number from the system
nFileNum = FreeFile
'OPEN the PDF file in Binary mode
Open sfilename For Binary Lock Read Write As #nFileNum
  ' Get the data from the file
  Do Until EOF(nFileNum)
    Input #1, s
    c = c + 1
    If c <= 10 Then
        pos = InStr(s, "/N")
    End If
    pos1 = InStr(s, "/count")
       If pos > 0 Or pos1 > 0 Then
            Close #nFileNum
            s = Trim(Mid(s, pos, 10))
            s = Replace(s, "/N", "")
            s = Replace(s, "/count", "")
            s = Replace(s, " ", "")
            s = Replace(s, "/", "")
            For i = 65 To 125
                    s = Replace(s, Chr(i), "")
            Next
            pages = Val(Trim(s))
            If pages < 0 Then
                pages = 1
            End If
            Close #nFileNum
            Exit Sub
        End If
        'imp only 1000 lines searches
        If c >= 1000 Then
             GoTo a
        End If
  Loop
    Close #nFileNum
    Exit Sub
a:
    Close #nFileNum
    pages = 1
    Exit Sub
End Sub
============================================
I actually went with a combined approach. Since I have exec disabled on my server I wanted to stick with a PHP based solution, so ended up with this:

Code:

function getNumPagesPdf($filepath){
    $fp = @fopen(preg_replace("/\[(.*?)\]/i", "",$filepath),"r");
    $max=0;
    while(!feof($fp)) {
            $line = fgets($fp,255);
            if (preg_match('/\/Count [0-9]+/', $line, $matches)){
                    preg_match('/[0-9]+/',$matches[0], $matches2);
                    if ($max<$matches2[0]) $max=$matches2[0];
            }
    }
    fclose($fp);
    if($max==0){
        $im = new imagick($filepath);
        $max=$im->getNumberImages();
    }

    return $max;
}
If it can't figure things out because there are no Count tags, then it uses the imagick php extension. The reason I do a two-fold approach is because the latter is quite slow.
==================================================
Try this :

<?php
if (!$fp = @fopen($_REQUEST['file'],"r")) {
        echo 'failed opening file '.$_REQUEST['file'];
}
else {
        $max=0;
        while(!feof($fp)) {
                $line = fgets($fp,255);
                if (preg_match('/\/Count [0-9]+/', $line, $matches)){
                        preg_match('/[0-9]+/',$matches[0], $matches2);
                        if ($max<$matches2[0]) $max=$matches2[0];
                }
        }
        fclose($fp);
echo 'There '.($max<2?'is ':'are ').$max.' page'.($max<2?'':'s').' in '. $_REQUEST['file'].'.';
}
?>

The Count tag shows the number of pages in the different nodes. The parent node has the sum of the others in its Count tag, so this script just looks for the max (that is the number of pages).

You can also use Spool File Page Counter SDK to count the pages in PDF file, Spool File Page Counter SDK can be downloaded from following web page,

http://www.verydoc.com/spool-page-count.html

Advanced PDF Tools Command Line has ability to count the PDF pages too, Advanced PDF Tools Command Line can be downloaded from following web page,

https://www.verypdf.com/pdfinfoeditor/index.html#dl

VN:F [1.9.20_1166]
Rating: 9.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
docprint pro

A4 be changed to Letter, Layout was changed after convertion

Dear Support team,

When we convert the document in Excel to PDF file using docPrint Pro v5.0, the margin is increased and contents shrinks. The paper size of original Excel document is "A4". Please kindly advice how we can convert the Excel to PDF without changing the original page setting in Excel. Is there any setting change required to retain the Excel format?

Thank you for your support in advance.
================================
Can you please let us know what version of MS Excel are you using? MS Excel 2003 does change the paper size from A4 to Letter during printing, if you are using MS Excel 2003, we suggest you may upgrade it to MS Excel 2007 or 2010 to try again, we hoping MS Excel 2007 or 2010 will work better for you.

If you are prefer to use MS Excel 2003, you can force to select A4 paper size on the docPrint PDF Driver, then you can print your Excel to docPrint PDF Driver to create a new PDF file at A4 paper, we hoping this solution will work fine for you too.

VeryPDF
=================================
It worked fine when we selected the A4 paper on the docPrint PDF Driver and changed page setting.

Thank you very much for the advice.
VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
docconverter com

HTML2PDF / DocConverterCOM.pdfout

We are running into issue with DocConverterCOM.pdfout because if someone restart web server this service does not start automatically.

We have two questions,
1. Is there a way to make sure DocConverterCOM.pdfout is always running?
2. Is there a way to put some error trapping code in VB.Net project so that if DocConverterCOM.pdfout is not running than it start this service and then calls method to convert HTML2PDF?


Thanks,
==============================
>>? Is there a way to make sure DocConverterCOM.pdfout is always running?

If you install DocConverter COM as a service, please set "VeryPDF DocConverter COM Service" service to "Auto Start" mode, this service will be started automatically after you reboot the server.

If you install DocConverter COM as a normal Windows application, please select "Auto Run After Reboot" menu item from right-bottom tray area, doc2pdf_service.exe application will run automatically after you reboot the server.


>>? Is there a way to put some error trapping code in VB.Net project so that
>>if DocConverterCOM.pdfout is not running than it start this service and then
>>calls method to convert HTML2PDF?

You can use following VB.NET code to check if doc2pdf_service.exe process running, if doc2pdf_service.exe process is running, it is indicate DocConverterCOM Service is running, you can call DocConverterCOM.pdfout to convert documents to PDF files correctly,

public bool IsProcessRunning(string name)
{
//here we're going to get a list of all running processes on
//the computer
foreach (Process clsProcess in Process.GetProcesses())
{
if (clsProcess.ProcessName.StartsWith(name))
{
//process found so it's running so return true
return true;
}
}
//process not found, return false
return false;
}

OR

//Namespaces we need to use
using System.Diagnostics;

public bool IsProcessOpen(string name)
{
//here we're going to get a list of all running processes on
//the computer
foreach (Process clsProcess in Process.GetProcesses())
{
//now we're going to see if any of the running processes
//match the currently running processes. Be sure to not
//add the .exe to the name you provide, i.e: NOTEPAD,
//not NOTEPAD.EXE or false is always returned even if
//notepad is running.
//Remember, if you have the process running more than once,
//say IE open 4 times the loop thr way it is now will close all 4,
//if you want it to just close the first one it finds
//then add a return; after the Kill

if (clsProcess.ProcessName.Contains(name))
{
//if the process is found to be running then we
//return a true
return true;
}
}
//otherwise we return a false
return false;
}

if doc2pdf_service.exe process is not running, you can call following command line to launch the "VeryPDF DocConverter COM Service" Service, then you can call DocConverterCOM.pdfout to convert documents to PDF files properly.

VeryPDF
=====================================================
I think you forgot to give command line code to launch “VeryPDF DocConvertor COM Service”,

We tried using below code to start service from .Net but it’s not working. Can you please help us?

Dim StartInfo As New ProcessStartInfo
StartInfo.FileName = "doc2pdf_service.exe"
StartInfo.Arguments = " -exe"
StartInfo.WorkingDirectory = "D:\Downloads\VeryPDF\doc2pdf_com_full_v2.5\doc2pdf_com_full_v2.5\"
StartInfo.UseShellExecute = True
Process.Start(StartInfo)
=====================================

If you run DocConverterCOM as a normal Windows application, you can use your sample code to launch DocConverterCOM application,
Dim StartInfo As New ProcessStartInfo
StartInfo.FileName = "doc2pdf_service.exe"
StartInfo.Arguments = " -exe"
StartInfo.WorkingDirectory = "D:\Downloads\VeryPDF\doc2pdf_com_full_v2.5\doc2pdf_com_full_v2.5\"
StartInfo.UseShellExecute = True
Process.Start(StartInfo)

However, if you use DocConverterCOM as a Windows Service, you need launch it by following command line,

net start "VeryPDF DocConverter COM Service"

e.g.,

Dim StartInfo As New ProcessStartInfo
StartInfo.FileName = "cmd.exe"
StartInfo.Arguments = " net start \"VeryPDF DocConverter COM Service\""
StartInfo.WorkingDirectory = "C:\"
StartInfo.UseShellExecute = True
Process.Start(StartInfo)

VeryPDF
================================
Thanks for your reply. This is exactly what we were looking for.

I have one more questions, Is there a way/method to check number of pages in PDF so that we can add extra check in our code. Idea is to check number of pages in PDF before appending signature page to it and after appending signature page.
============================
You can count the pages in PDF files easily, please refer to following web page for more information,

Counting the exact number of pages in any PDF document

VeryPDF
============================
We been ask to prove that this tool will append HTML 2 PDF every time. We have seen that there’s not good error trapping/handling available with this one. Is there a way to make 100% sure of job running and appending page? We have already added check for number of pages before and after appending html and also added check to make sure that doc2pdf_service.exe process is running.

Also can you please tell us what is ISO standards or security settings we are using for this tool?
============================
1). We apologize for any inconvenience this may have caused to you, this is a strange problem of append HTML file to existing PDF file, when we run the command line in CMD window, it does append HTML file to PDF file without any problem, this problem is appear in ASP code only, we sure it is caused by permission settings, but we can’t find out the reason at the moment.

However, in order to solve this problem quickly, we can present a copy of PDF Split-Merge Command Line application to you free, you can convert HTML file to PDF file first, and then call PDF Split-Merge Command Line application to combine two PDF files into one PDF file, we sure this solution will okay to you.

You can download the full version of PDF Split-Merge Command Line application from following URL,

XXXXXXXXXXXXXXXX

After you unzip it to a folder, you can run following command line to merge two PDF files into one PDF file,

Pdfpg.exe C:\test1.pdf C:\test2.pdf C:\out.pdf

You can call pdfpg.exe from your ASP code to combine two PDF files into one PDF file easily, we sure this solution will solve “appending HTML to PDF file” problem quickly.

2). Sorry, we don’t understand your meaning, do you wish create the PDF file with security settings?

VeryPDF
============================

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