tag:blogger.com,1999:blog-79637944145472795192024-03-06T01:29:30.398-08:00PDF ... inside and outsidemy comments and future planningsIngo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-7963794414547279519.post-71127066708582075262022-01-25T14:09:00.002-08:002022-01-25T14:13:21.569-08:00Washing day for PDF documents and -forms!Like i've already explained in my blog years ago Adobe products for form creation used inserted checksum-/encryption-routines to prove if a form (created by an adobe tool) was changed by a third party pdf tool.<br>
What does this mean? If a pdf-form or pdf-document made by an adobe tool was changed by a third party tool (fill in data and save it into the form is a modification as well) is opened by the adobe reader all form fields are not usable anymore. The form is just a simple document! Only an ugly popup-message appears telling me this:<p>
<i>"This document enabled extended features in Adobe Acrobat Reader. The document has been changed since it was created and use of extended features is no longer available. Please contact the author for the original version of this document."
</i><p>
I've made these experiences with forms created by the adobe products "InDesign" and "LiveCycle Designer"...
<p>
<p>
These problems are now issues from the past! Now i've published a cmd-exe which removes the described restrictions and all usage rights within a second. I've called it "Unlock_ALD" (32- and 64 bit version) and it works from the commandline in Windows.<p>
First start processing the pdf-file with Unlock_ALD and then we can work with the adobe reader and the foxit reader and any third party tool and perhaps again with an Adobe product... without these annoying restrictions anymore.<p>
<b>There are four ways to use Unlock_ALD:</b><br>
1. Directly from the command-line.<br>
2. Inside your batch-scripts (bat- or cmd-files).<br>
3. From the explorer context menu via "send to...".<br>
4. Inside your own published/distributed applications and projects via shell-syntax.<p>
[ more details you can read on my website at "products" ... <a href="https://www.pdf-analyzer.com/mprod26.html">More informations regarding Unlock_ALD</a> ]
<p>
<p>
<p>
<p>
[All used names of trademarks, labels and companies are under the copyright of the respective companies and belongs to these companies or individuals.]
<p>
<p>
Cheers and have a nice day,<br>
Ingo Schmoekel
Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-22208021727273220642019-12-05T12:55:00.002-08:002019-12-05T13:00:08.291-08:00PrPages - Individual enhancements - everything is possible!<div class="separator" style="clear: both; text-align: center;">
<br /></div>
PrPages is used to determine the coloured and monochrome (b/w or gray) pages of a pdf-document.<br />
This may e.g. to get more accurate costing of copy jobs or for printing costs of company-departments.<br />
<br />
<b>If you only have to decide whether it should be a monochrome print or a color printout, a single coloured page in a 30-pages pdf-document can generate a much more expensive color copy from a - actually - mainly b/w copy. That hurts, of course, if you have to save money ;-)</b><br />
Now back to PRPages ... Which page has coloured elements, which is completely b/w we should know using PrPages. This probably helps to reduce cost in the printing area. It would be even better, if you could extract and print the coloured pages separately.<br />
<br />
A prospect came to me with questions regarding the described problem ... He asked me to develope an individual solution for him.<br />
<br />
After some considerations, the free tool PDFtk came to my mind again. The command line tool PDFtk offers i.a. functions to connect single pdf-pages to a new document, to split pdf-documents into single pages, to connect single pages according to specification for a new document and much more.<br />
PDFtk and the CMD instruction set from Microsoft for creating BAT files (yes ... the files with the extension BAT) would be enough to realize the desired individual solution free of charge.<br />
<br />
<b>1. PrPages</b><br />
<br />
PRPages creates a csv-file with all relevant data (regarding used colors and so on) for each page of a whole pdf-document.<br />
<br />
<b>We need a bat(ch)-file to start PrPages with some parameters in the directory of PrPages. It can be look like this:</b><br />
<br />
@echo off<br />
if "%~1"=="" goto input1<br />
set testvar1=%~1<br />
IF EXIST rows.txt del rows.txt<br />
IF EXIST rows.csv del rows.csv<br />
prpages %testvar1% E 00 rows.csv<br />
ren rows.csv rows.txt<br />
goto end<br />
:input1<br />
echo The 1st parameter for the input-file (for example: "c:\temp\catalogue.pdf") is missing!<br />
:end<br />
<br />
This bat(ch)-file - let us call it get_colors.bat - called from the cmd-line (eg. "c:\temp\pdftk\>") could be look like this:<br />
<br />
<i>get_colors c:\temp\catalogue.pdf</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXfKi3Qu_v8dlYj994HlGPzpu2GecDTgKBEY2maEVt0u5ypUTn8YKQZ1kznzovjTaJkoEsVFz5ImnNR6kxou7uosouwpVhnL_4zqRXbm6U2PVhlsqlcnHXLt1Kz8KSo_UHJKFaupWoJJQ/s1600/b1.1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="165" data-original-width="412" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXfKi3Qu_v8dlYj994HlGPzpu2GecDTgKBEY2maEVt0u5ypUTn8YKQZ1kznzovjTaJkoEsVFz5ImnNR6kxou7uosouwpVhnL_4zqRXbm6U2PVhlsqlcnHXLt1Kz8KSo_UHJKFaupWoJJQ/s400/b1.1.jpg" width="400" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<b> </b><br />
<b>The result should be a file rows.txt with a content similar to this one:</b><br />
<br />
c:\temp\pdftk\catalogue.pdf;1;842;595;color; <br />
c:\temp\pdftk\catalogue.pdf;2;842;595;color; <br />
c:\temp\pdftk\catalogue.pdf;3;842;595;bw/gray; <br />
c:\temp\pdftk\catalogue.pdf;4;842;595;bw/gray; <br />
c:\temp\pdftk\catalogue.pdf;5;842;595;bw/gray; <br />
<br />
<b>2. Doing the real page extraction and reconcatenation into two new separated files (color and b/w)</b><br />
<br />
For this we use PDFtk that provides functionality for separating and merging individual files.<br />
On the command-line this can eg. look like this:<br />
<br />
<i>pdftk c:\temp\catalogue.pdf cat 2 5 8 9 12 output outputc.pdf</i><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNZrBpWPsaEdV6ukfq4GithW8T4jqCKrk0prElbBAKNGDZva6G_0QvK-3OGlQSqpTeGsl1awF4hDu6-WIeQdZtggyomJxCaC1Htp_B_GBsJLpS-hyZe-4Le0Bskm9tdBSpddBlpX52IFI/s1600/b2.1.jpg" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="167" data-original-width="641" height="103" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNZrBpWPsaEdV6ukfq4GithW8T4jqCKrk0prElbBAKNGDZva6G_0QvK-3OGlQSqpTeGsl1awF4hDu6-WIeQdZtggyomJxCaC1Htp_B_GBsJLpS-hyZe-4Le0Bskm9tdBSpddBlpX52IFI/s400/b2.1.jpg" width="400" /></a><i><br /></i><br />
<br />
<br />
<br />
<br />
<br />
So we have to extract from the file rows.txt the coloured pages using the determined page-numbers. With these page-numbers we have to concatenate a string as a new parameter for PDFtk ...<br />
<br />
<b>The most important line in the bat(ch)-file for this functionality is:</b><br />
<i>for /f "tokens=2 delims=;" %%i in ('findstr /C:";color;" %testvar2%') do echo %%i>>color.txt</i><br />
<span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">tokens=2 ... means the second column in the csv-file rows.txt. The second column contains the page number.<br />delims=; ... determines the used field separator.<br />findstr ... is an internal cmd-command for string searches in files.<br />;color; ... shall be now the string we're searching for in rows.txt.<br />%testvar2% ... this variable contains the parameter from calling the bat(ch)-file (eg. the csv-file rows.txt).<br />do echo %%i>>color.txt ... the output of the page numbers in lines with the string ";color;" will be in color.txt.</span></span><br />
<b>color.txt now contains the page numbers in a vertical arrangement.<br />From this file content (the numbers) we have to create a string:</b><br />
<br />
<i>FOR /F %%i in (color.txt) do call set "Myvar1=%%Myvar1%% %%i"</i><br />
<span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">for ... means loop-processing.<br />%%i ... this variable contains the currently read line content (the page number).<br />color.txt ... this is our file with the page numbers for the coloured pages.<br />Myvar1 ... this is the name of the variable for the string with the page numbers.<br />%%Myvar1%% ... means the content of variable Myvar1<br />Myvar1=%%Myvar1%% %%i ... means Myvar1=previous content of Myvar1 and additionally the new content (the next number).</span></span><br />
At the end of the loop-processing Myvar1 contains a string like 2 5 8 9 12 for example.<br />
<b>Finally the last important line in the bat file can look like this:</b><br />
<br />
<i>pdftk %testvar1% cat %Myvar1% output outputc.pdf</i><br />
<span style="font-size: small;"><span style="font-family: "courier new" , "courier" , monospace;">%testvar1% ... contains file- and path-name of the original pdf-document.<br />cat ... is a command from PDFtk to separate pages (single or ranges).<br />%Myvar1% ... contains the string with the page numbers from variable Myvar1.<br />output ... is a command from PDFtk to write the separated pages into a new pdf-document.<br />outputc.pdf ... finally this file contains the coloured pages 2, 5, 8, 9 and 12 from the sample-pdf.</span></span><br />
Finally, the whole bat file with additionally - hopefully self-explanatory - lines.<br />
To complete the whole process, it also includes the processing for the b/w pages:<br />
<br />
@echo off<br />
if "%~1"=="" goto input1<br />
set testvar1=%~1<br />
if "%~2"=="" goto input2<br />
set testvar2=%~2<br />
SET "Myvar1="<br />
SET "Myvar2="<br />
IF EXIST color.txt del color.txt<br />
IF EXIST bwgray.txt del bwgray.txt<br />
for /f "tokens=2 delims=;" %%i in ('findstr /C:";color;" %testvar2%') do echo %%i>>color.txt<br />
for /f "tokens=2 delims=;" %%i in ('findstr /C:";bw/gray;" %testvar2%') do echo %%i>>bwgray.txt<br />
FOR /F %%i in (color.txt) do call set "Myvar1=%%Myvar1%% %%i" <br />
for /f %%i in (bwgray.txt) do call set "Myvar2=%%Myvar2%% %%i"<br />
IF EXIST outputc.pdf del outputc.pdf<br />
IF EXIST outputb.pdf del outputb.pdf<br />
echo color pages: %Myvar1%<br />
pdftk %testvar1% cat %Myvar1% output outputc.pdf<br />
echo bwgray pages: %Myvar2%<br />
pdftk %testvar1% cat %Myvar2% output outputb.pdf<br />
goto ende<br />
:input1<br />
echo The 1st parameter pdf-inputfile (eg.: "c:\temp\catalogue.pdf") is missing!<br />
goto end<br />
:input2<br />
echo The 2nd parameter csv-outputfile (with color data) (eg.: "c:\temp\rows.txt") is missing!<br />
:end<br />
<br />
The variable call of this bat-file (let us call it get_pages.bat) from the command line could be eg. look like this:<br />
<i>get_pages c:\temp\catalogue.pdf c:\temp\rows.txt</i><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQR0TGwaz9JOgwE0_5HOveIknxMcdj8yr7GrXpXhzIfkKDDeCylU5ouFzUBf4RhhuedVu5rHQTOPqeWPesLVtpgSmL2WTRjclkjmt_4_ZyIahpCPeDQ826RzlLqcvHghhKR_MC_lCl4C4/s1600/b3.1.jpg" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="170" data-original-width="528" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQR0TGwaz9JOgwE0_5HOveIknxMcdj8yr7GrXpXhzIfkKDDeCylU5ouFzUBf4RhhuedVu5rHQTOPqeWPesLVtpgSmL2WTRjclkjmt_4_ZyIahpCPeDQ826RzlLqcvHghhKR_MC_lCl4C4/s400/b3.1.jpg" width="400" /></a><i> </i><br />
<br />
<br />
<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
</div>
<b>As a result, we get two new files from the original file (which will be preserved) - one with colored PDF pages, one with b/w pages, which can then go to the copy shop or print out on a color or b/w laserprinter.</b><br />
<br />
<br />Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-26433289606265885662015-05-29T12:19:00.001-07:002015-05-29T12:19:33.160-07:00Determine dpi-values from pdf- and image-filesI just received an e-mail inquiry from a customer with the question how to determine the dpi values from PDF and image files ...<br />
<br />
The dpi value can be calculated in an easy way.<br />
1 dpi means 1 pixel per inch and 1 inch has 2.54 cm.<br />
An image file with a width of 1024 pixels and 10 cm width has a dpi of (1024 x 2.54) / 10 ... so in this case 260 dpi.<br />
<br />
An A4 PDF has the standard dimensions of 595 x 842 pixels.<br />
With 21 cm width and a pixel width of 595 this results in:<br />
(595 x 2.54) / 21 ... so you get the common 72 dpi.<br />
<br />
This means if an A4 PDF page is rendered directly to an image file, the quality won't be great, because the quality has a fix limit of 72 dpi.<br />
<br />Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-81597683734651096972014-12-23T00:25:00.001-08:002014-12-23T00:25:08.390-08:00Foxit versus Adobe ... or "David against Goliath"Since many years now Adobe as the driving force keep on publishing their pdf format as a "de facto standard" mainly established for online and graphical documents. Due to the fact that a document standard should be usable for all users (for reading) Adobe published the free Adobe Reader for PDF documents.<br />
<br />
Of course pdf documents have to be created before reading ;-) On one hand there are the normal documents but on the other hand the pdf-format is well suited for all types of forms. By embedding e.g. JavaScript actions and buttons much life can be breathed into pdf forms. <br />
<br />
For all these things, there are a number of Adobe products - paid products in a high cost range. Since version 1.0 of the PDF specifications many years have passed and with each new version of an Adobe Reader installation the required harddisk space increased by many megabytes. This fact called the Open source community into action. Source Based on a free library like e.g. Ghostscript alternative ways of free PDF creation as printer drivers were developed. These printer drivers are usable inside most office products. Two well known free pdf printer drivers are PDFCreator and FreePDF. In the meantime there are some more free pdf readers published. There are portable versions, too. So there's no need to install - only copying anywhere onto the harddisk. That's all. <br />
<br />
One of the best adobe alternatives - perhaps the best - regarding free pdf readers is the well known Foxit PDF reader. While an Adobe Reader 10 installation needs about 457 mb harddisk space, the Foxit Reader 5.4.2 comes along with slim 44 MB! ... And less megabytes means less harddisk space and this means often higher processing speed and a faster start, too! An additional hint: If you only want to read/show pdf documents the small "Sumatra PDF" (specially the portable version) is all you need.<br />
<br />
What could be the reason for a big company like Adobe spending a lot of money to establish a document standard? ... Of course 'cause they are always the first with new pdf-products to earn money ;-) So actually there's not only the Adobe Reader but also the high-priced products from the Adobe Acrobat series that allow everything related to the creation of PDF documents.<br />
<br />
That pdf-products can be much cheaper (with a comparable quality) is proving the Foxit Corporation - Manufacturer of the free Foxit PDF Reader. Started with the free Foxit pdf reader, now the company offers a wide range of lean and more cost-effective products for the development and editing of pdf documents. The products are running on nearly any technical basis (windows, iOS, Android, ...). This ranges from applications for PDF editing and creation up to complete developer sdks. All this with a very "nice price" licensing procedure.<br />
<br />
As a developer in the pdf environment of course i have several products and versions of pdf readers and various versions of the Adobe Reader installed. This allows me for example to say "runs on Adobe ... too". But in my daily business i'm just using the Foxit Reader - Give it a try ;-)<br />
<br />
Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-62750037344081835052013-12-19T06:01:00.001-08:002013-12-19T06:01:08.727-08:00PrPages now supports “gray value tolerance”!The new option “gray value tolerance” makes PrPages rather complete. What is the purpose and sense of this value which is also known as "gray balance"? <br />
<br />Because sometimes slightly shading gray colours could be interpreted as very slight light blue or pink color tones for example some main printer-drivers are working with an optionally so called “gray value tolerance” or "gray balance". <br />
<br />
PrPages splits each pixel of the pdf-page into the three rgb-values. The “gray value tolerance” represents the difference between the highest and the lowest rgb-value. A value of 15 (by the way <br />
that’s good practice) means that the highest and lowest colour-value (the values are from 0 up to 255) of a pixel can differ at most by the value 15 and still be interpreted as a shade of gray.<br />
<br />
Without a tolerance value even the smallest deviation leads to a colour-detection because the slightest difference means that it's not real gray.<br />
<br />
Summarized it could be gray or … perhaps a very, very light blue? Anyway not an absolutely clear gray – so there are few coloured pixels on a page and it’s up to you what you want. Some main printer-drivers are working with optionally “gray value tolerances” and if you need identical results <br />
for your work or accounting you should use these option with PrPages, too.Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-54517195806075142492012-12-03T13:51:00.002-08:002012-12-03T13:51:15.042-08:00Analyze PDF-documents for coloured pagesThe calculation of printing costs for pdf-documents separated <br />for each serviceline or department in a company is always a <br />problem. How many pages - coloured or black & white - were printed?<br />Which were the dimensions of the printed pages? Which are the<br />responsible company departments? And finally: Who should be <br />responsible for the costs of new toner cartridges?<br /><br />Internally the pdf-structure offers the device-flags like<br />- for example - DeviceRGB, DeviceGray oder DeviceCMYK which<br />points to the used colours in the document. Better: It could <br />point 'cause it's not a must to use device-flags in the pdf-<br />document. It's possible to have coloured pages in a document<br />with DeviceGray and it's possible to have coloured and b/w-pages<br />in a document without any device-flag and it's possible to<br />have only b/w-pages in a document with DeviceCMYK and so on...<br />So the device-flags are only indicators for the used colour-<br />models in a document but not a save method to determine<br />coloured pages.<br /><br />This is a big problem in service-departments! There are<br />solutions available ... very expensive solutions.<br /><br />For the described purpose i'm offering in my product range <br />the module "PrPages". It's a so-called command-line exe.<br />A batch executable means easiest installation with all <br />applications and workflows in 32 - and 64-bit Windows <br />environments without any problems!<br /><br />The module's approach is that the real colour informations <br />are in each image pixel and based on this informations<br />you can make the only reliable statement regarding the<br />used colours on a pdf-page.<br />The graphic type bitmap offers three values for colour-<br />settings on pixel level. "PrPages" renders the pdf-pages <br />temporarily into bitmap format and checks the pixel values <br />for the colour informations to analyze the pages as b/w or<br />coloured.<br />Depending on the options you have set, a csv-file is created.<br />Each line contains the filename, the page count, the page <br />size of the first page, the pagecount for coloured and <br />the pagecount for b/w-pages.<br />Another option results in one line for each pdf-page with <br />the filename, single page number, the page size and a note <br />for b/w or coloured.<br /><br />Depending on the system environment the module works with<br />high performance using a safe and stable technology.<br />On my<a href="http://www.is-soft.de/pdfanalyzer/prod25.htm"> product pages</a> you'll find the "PrPages" as a trial<br />version to check if the tool is the right choice for your <br />purposes - Try before you buy.<br /><br />Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-49982955774506778432012-04-09T12:36:00.002-07:002012-12-03T14:05:51.745-08:00PDF, JavaScript and Code you don't wantMy dear readers!<br />
<br />
Regarding trojan- and virus-attacks often you can read about pdf-documents entering your local machine as email-attachments. While opening these attachments it's possible that embedded trojans and other malware will be installed unvisible or system settings could be changed.<br />
<br />
This works via scriptlanguage JavaScript. With embedded JavaScript-code the functionality of a pdf-document can be greatly expanded. The embedded code will be coupled with an event like OnLoad (that's while a document will be opened) and then executed if the event happens. Normally this is a positive thing but it may also be to your detriment.<br />
<br />
Installing your Adobe- or Foxit-PDF-Reader (which are able to interprete Javascript-Code) it's a standard that using Javascript is activated. It's an optional setting which can be deactivated by you again.<br />
<br />
Deactivating Javascript in <span style="font-weight: bold;">Adobe Reader 9 or 10</span> (for example) you can go this way:<br />
<br />
...Edit -> Preferences -> JavaScript...<br />
<br />
in the right window section you can remove the marks in the checkboxes at<br />
"Java Script / Enable Acrobat JavaScript" and<br />
"Java Script Security / Enable menu items Javascript execution privileges".<br />
<br />
Deactivating Javascript in <span style="font-weight: bold;">Foxit-Reader 5</span> goes like this:<br />
<br />
...Tools -> Preferences -> JavaScript...<br />
<br />
Remove the mark at the checkbox at<br />
"Enable Javascript actions".<br />
<br />
If you don't want to deal with such things and if an easy pdf-reader is enough for you should try the small and easy to use <span style="font-weight: bold;">Sumatra PDF Reader</span> which aren't able to interprete JavaScript.<br />
<br />
Cheers,<br />
IngoIngo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-89477357619263006782011-03-02T13:38:00.000-08:002011-03-02T13:39:52.167-08:00Printing pdf from your appMy dear readers!<br /><br />I've got a user call having to do with printing from a self made application by using the installed pdf-reader (try Foxit... the best for me!).<br />I've tried some time using the Keybd_Event-syntax from my Delphi/Pascal for virtual key-activations.<br />If you're using Delphi or Free Pascal you can put the code below directly into a button-event (OnClick) of your application. Other programming-languages will offer a pretty similar syntax. With the sleep-property you can do some experiments.<br /><br />procedure TForm1.Button3Click(Sender: TObject);<br />begin<br />// At the uses-part don't forget the ShellAPI ;-)<br /><br />// Show/open the pdf-document ...<br /> ShellExecute(hinstance,'open',PChar('c:\temp\test.pdf'),nil,nil,SW_NORMAL);<br /><br /> sleep(2000); // sleep/wait for 2 seconds<br /><br />// Virtual Keys [Strg] + [P] to open the print dialog ...<br /> Keybd_Event(VK_CONTROL,0,0,0);<br /> Keybd_Event(Ord('P'),MapVirtualKey(Ord('P'), 0),0,0);<br /> Keybd_Event(Ord('P'),MapVirtualKey(Ord('P'), 0),KEYEVENTF_KEYUP,0);<br /> Keybd_Event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);<br /><br />// Virtual key [ENTER] to start printout ...<br /> Keybd_Event(VK_RETURN,1,0,0);<br /> Keybd_Event(VK_RETURN, 1, KEYEVENTF_KEYUP, 0);<br /><br /> sleep(2000); // sleep/wait for 2 seconds<br /><br />// Virtual keys [Alt] + [F4] to close the active reader-window ...<br /> Keybd_Event(VK_MENU,0,0,0);<br /> Keybd_Event(VK_F4,0,0,0);<br /> Keybd_Event(VK_F4,0,KEYEVENTF_KEYUP,0);<br /> Keybd_Event(VK_MENU,0,KEYEVENTF_KEYUP,0);<br /><br />end;Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com2tag:blogger.com,1999:blog-7963794414547279519.post-50183627793543448792010-03-29T03:52:00.000-07:002010-03-29T04:08:14.087-07:00From PDF to SAP SmartForms ... automaticallyMy dear readers!<br /><br />The reason in short ...<br />We had planned a banking product for several eligible customers based on an extensive form management in SAP Smartforms. We were facing problems like "only pdf-forms available" or "old pdf-forms should be completely redesigned". For a bank this can mean that hundreds of forms have to be converted... and the time is always short ;-)<br /><br />Starting this project we knew that the needed new form creation in SAP Smartforms and the insertion of the recent pdf-forms into SAP would be the biggest time-package – not easy to be calculated. We discussed the idea to create a converter to manage at least the simple tasks of converting in an automatic way.<br /><br />We had to regard two starting positions:<br />There were pdf-forms which should be transfered to SAP.<br />There were pdf-forms which should be completely redesigned before transfering to SAP.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg39o18HydABfISkzIAtscSOPc84rJK4ZgUdUX9fJ0a-lx4q5n1_RWHiNGiRsZhZ-n6qN5L4_3W-ZJIuQIG-XtdJsUHi-7IhBCAMS2Jw4Azfvg2WEqGjfhUdiBuSEsOSxgsguGxaBPYkIA/s1600/image01001.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 304px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg39o18HydABfISkzIAtscSOPc84rJK4ZgUdUX9fJ0a-lx4q5n1_RWHiNGiRsZhZ-n6qN5L4_3W-ZJIuQIG-XtdJsUHi-7IhBCAMS2Jw4Azfvg2WEqGjfhUdiBuSEsOSxgsguGxaBPYkIA/s400/image01001.jpg" alt="" id="BLOGGER_PHOTO_ID_5454010720306134466" border="0" /></a><br /><br /><br /><br />Our basically idea was to extract the pdf-formfield data and properties, insert the data into an xml-structure and using the xml-uploadfunction in Smartforms as the final step. There were forms with less data and a clear structure but also very detailed and overcrowded structures. So we kept in mind that sometimes it would be probably necessary to turn a few screws directly in the converter source. The second part of the work should be the new designed forms. Here we started directly from scratch, creating doc-prototypes with associated technical files containing the formfield-properties. So no existing pdf-form for us. We decided to manage this problem with a different version of the converter. Both converter versions should be developed as a .NET-application. We used C# as ide.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIRCE_6RfaXWvgvYLnKXpJ5SGkpSp0owpwBriVnSh4P-NbVqEqtKLP2cCryXgHYFV1SM1brNdX7D5yoT7D6XpGjnwU9-jzLA7dwkMD50pfyTd-2goyVx5mA_G29H-lir5cb3FgvkbKzTE/s1600/image01003.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 229px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIRCE_6RfaXWvgvYLnKXpJ5SGkpSp0owpwBriVnSh4P-NbVqEqtKLP2cCryXgHYFV1SM1brNdX7D5yoT7D6XpGjnwU9-jzLA7dwkMD50pfyTd-2goyVx5mA_G29H-lir5cb3FgvkbKzTE/s320/image01003.png" alt="" id="BLOGGER_PHOTO_ID_5454008384585356610" border="0" /></a><br /><br /><br /><br />Behind the converter-gui there are batch-modules (developed with Delphi as commandline-tools) doing three jobs for us:<br />• Extracting the main form-properties like used fonts, the form dimensions, date and time of creation, and so on.<br />• Extracting all form-fields with name, position values and field-lengths.<br />• Converting the displayed form content into a tiff-file, regarding the SAP tiff-specifications and the needed dpi-value as a backgoundimage for Smartforms.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9V6IzauHtM-zAU9u3LQQEiQ45nplOK3sjZJMIM6B6AtyIZfzvyrPUdqYPTgwUQt-Ds6DdwJpjbMJRDzctNTNkLLjvTmHixTXka4Q4_pDOylc4XWbLtKjOPbOGZ-D1SxtmYYbJzJrUiPM/s1600/image01007.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 121px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9V6IzauHtM-zAU9u3LQQEiQ45nplOK3sjZJMIM6B6AtyIZfzvyrPUdqYPTgwUQt-Ds6DdwJpjbMJRDzctNTNkLLjvTmHixTXka4Q4_pDOylc4XWbLtKjOPbOGZ-D1SxtmYYbJzJrUiPM/s320/image01007.jpg" alt="" id="BLOGGER_PHOTO_ID_5454008857902270978" border="0" /></a><br /><br /><br /><br /><br />The next point was a valid xml-structure to have a look inside. We got it doing a local xml-download of an existing form from Smartforms. We analyzed it, determined the parts which would be always the same and the parts which would be changed programmatically with variable values. We splitted the xml-structure into constant and variable templates. In the templates we signed the significant positions with unique placeholders. Our converter should transform all these things like form properties, field data, reference to the backgroundimage, constant and modified templates as the final step into one new xml-file for the Smartforms-upload.<br /><br />To prepare Smartforms for the xml-upload first we have to create one single time a formstyle with all possible fontstyles used in the uploaded forms. Another point are the backgroundimages. They are created automatically while generating the upload-xml-structure but the local tiff-files still need to be transported into the SAP Form Graphics Administration (transaction SE78). At this time the referenced link is already in the xml-structure.<br /><br />So the steps for existing pdf-forms are:<br />• Starting the converter.<br />• Selecting a pdf-form and moving through the converter-steps.<br />• Uploading the new tiff-file via transaction SE78 into SAP.<br />• Uploading the new xml-file into SAP Smartforms.<br />• Activating the new form in Smartforms. …That’s it!<br /><br />At least the converter version for the non-existing forms… In this case the workflow is a bit different. The form properties are already extracted `cause we have the ascii-files with all form- and formfield-properties and bmp- or doc-prototypes.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3fwBccfctLnzAAPczLaZdQqMIYKxj8PF4m3gf0RaZ54RQGIojZxarPNIJjMZ60vf5FFAaaA_GiCIRIDhFRKbxNZeUYKhYbi5Sxi_pzjK4cpnMm4KOnVWAV_z4XMeg3cvpaAzEAwHzUCM/s1600/image01009.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 187px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3fwBccfctLnzAAPczLaZdQqMIYKxj8PF4m3gf0RaZ54RQGIojZxarPNIJjMZ60vf5FFAaaA_GiCIRIDhFRKbxNZeUYKhYbi5Sxi_pzjK4cpnMm4KOnVWAV_z4XMeg3cvpaAzEAwHzUCM/s320/image01009.png" alt="" id="BLOGGER_PHOTO_ID_5454009147130270754" border="0" /></a><br /><br /><br /><br />First step is to convert the bmp- or doc-file into the tiff-format according to the SAP specifications. We’re using for this job the free graphic application „Gimp“. Although „Irfan View“ would be a good candidate for this job we should keep in mind that this application is only free for personal use. Then these tiff-files will be transfered into the SAP Form Graphics Administration (transaction SE78), too. Instead of grabbing the form- and field- properties from the pdf-form via commandline-tools the second version of the converter can read the needed data out of these technical ascii-files which come along with the bmp-prototype. At this stage the flow is the same. The xml-file will be created … uploaded …<br /><br />So the steps for completely new forms are:<br />• Converting the bmp-file into tiff-format<br />• Uploading the new tiff-file via transaction SE78 into SAP.<br />• Selecting the technical form-data-file moving through the converter-steps.<br />• Uploading the new xml-file into SAP Smartforms.<br />• Activating the new form in Smartforms. …That’s it!<br /><br />There’s one restriction: The described procedures concentrates themselves on the main task – creating single-page-forms. Sure it’s possible to enhance the converters for multi-page-forms but in our special case the cost-benefit ratio wouldn’t have a good relationship.<br /><br />All together we had to convert approximately 300 forms. Normally this work would have lasted 100 days. With our converters we could do this job in less than 10 days!Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com2tag:blogger.com,1999:blog-7963794414547279519.post-57738149875639319552009-11-18T11:25:00.000-08:002009-11-18T11:30:17.670-08:00Another kind of fast web access!My dear readers!<br /><br />Are you offering free pdf documents on your webpages?<br />Are these pdf documents very large?<br />Is the free traffic in your web-package limited?<br /><br />To prevent bad surprises and to gain new interested web-visitors you should try my app <span style="font-weight:bold;">PDF-Analyzer Pro</span> or my <span style="font-weight:bold;">PDFIndexCut.dll</span> (for using in batch).<br />I'll tell you why ...<br /><br />If you want to upload a large document you should think at the interested user with a slow internet-connection, too.<br />It doesn't matter if you're using the linearized (fast web access) option while creating the document. Sure... the user can read the first pages very quickly but in the background the pdf-download grows more and more on his local harddisk. Often enough after reading the first pages the user knows that the document is worthless for him - one worthless download for him and worthless traffic for you as the website-owner, too.<br /><br />Using my <span style="font-weight:bold;">PDFIndexCut</span> it's possible to separate documents in two parts - the first one we can call the index-part and the second one the content-part. The index-part should contain only the title-page and the index or the first starting pages. In the index-part there are free positionable links to the content-part.<br /><br />If these two document-parts are online the interested visitor can open/download the small index-part to get a first impression about the whole document if it could be useful for him or not. If it seems to be useful he can click on the content-link in the index-part to open/download the large content-part. If it seems to be useless for a user there's only a small download and not mbytes of useless pdf-garbage on the local harddisk and you as the website-owner can keep the traffic low.<br /><br /><span style="font-weight:bold;">PDFIndexCut</span> has options for the pagenumber where the document shall be separated, for the positions of the content-link and for the content-link-text. <span style="font-weight:bold;">PDFIndexCut</span> is very flexible and should feed your needs, too.<br />If you have only less large documents you can use my app <span style="font-weight:bold;">PDF-Analyzer Pro</span> 'cause the functionality from <span style="font-weight:bold;">PDFIndexCut</span> is there implemented.<br />Give it a try... there's a testversion available online.Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-9576365031325941662009-09-23T02:03:00.000-07:002009-09-24T11:42:02.847-07:00Under the surface ...Did you ever had the idea to look inside the real pdf-code while looking through a pdf-document? If you have some technical understanding this can be very interesting for you. What do you need for this? You already have everything to look inside... Try your editor "Notepad" from your windows-system. With a little bit luck you'll see that the internal pdf-code is readable, too.<br /><br />The first important information you'll find at the beginning of the pdf-file. There's something like "%PDF-1.3%âãÏÓ" (for example). Some characters you can ignore but the "PDF" shows you that it's a pdf-file (what a surprise). The "1.3" means that this document was created according to the (older) pdf specification 1.3.<br />Now you should try the search-function from your editor...<br /><br />Try a search with "FontName". Sure you'll find more than one entry in your code showing you all embedded/used fonts in your document. Such an entry could look like this one: "/FontName/Arial-BoldItalicMT/".<br />Some other interesting searchkeys/tags for you are: "Creator", "CreationDate", "Producer", "ModDate", "Title", "Keywords" or "Subject" for example. If you can't find a tag, this means only that there's no content for it. If there's no maintained title for the document you won't find the tag "Title" in the code. <br /><br />If the document is encrypted the text following the tags isn't readable but even this gives you an information about the document ... it's an encrypted document ;-)<br />Finally another interesting tag "Count" oder "/Count". Here you'll find the pagecount of the document. This could look like here: ".../Count 9/...".<br />A little more appetite for PDF? Time to go on discovering ;-)Ingo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com0tag:blogger.com,1999:blog-7963794414547279519.post-71024583490870709032009-06-20T07:11:00.000-07:002009-06-23T22:43:24.129-07:00PDF and formsMy dear readers!<br /><br />Today i want to write about pdf and forms. A good topic for adobe - a bit like a money machine ;-)<br /><br />In the past we're happy to fill a pdf-form directly on the monitor ... then doing the printout ... 'cause saving the formfield data with the adobe reader wasn't possible ... and the next time we would fill the data again ... :-(<br /><br />These were the good old days if we're knowing only the free adobe reader for reading pdf documents...<br /><br />Now there are better days. Since a while there is the free foxit pdf reader on the market. Faster and more slim than the adobe reader. With all functionality what the "normal" user in front of the monitor requires. ...And he can fill in formfields, and he can save the filled formfields, and if the form is loaded again these values can be changed... and saved again ...! The foxit reader is my absolute favorite!<br /><br />What does the "great pdf inventor" ...? No. He doesn't enhance his pdf reader... but he enhance his form creation tools and build in check routines to proof if a form (created by an adobe tool) was changed by another pdf tool. What does this mean? If a form made by an adobe tool was changed (and fill in data and save it into the form is a modification) is opend by the adobe reader all form fields are not usable anymore!<br /><br />I've made this experiences with a form made by the adobe product "InDesign".<br /><br />But there's no problem without a solution. And if we don't have the solution then we have to create it ;-)<br />Soon i'll create a tool (dll or application ... we will see) which can take all properties and formfields from an adobe form building a new quite similar form without all these check routines. With these form we can work with the adobe reader and the foxit reader and ... without these annoying restrictions. <br /><br />[All used names of trademarks, labels and companies are under the copyright of the respective companies and belongs to these companies or individuals.]<br /><br />Cheers and a nice day,<br />Ingo SchmoekelIngo Schmökelhttp://www.blogger.com/profile/17175648467163733582noreply@blogger.com2