LEADTOOLS Support
Document
Document SDK Questions
Re: Script error when saving scanned images as PDF
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, October 21, 2010 10:31:25 PM(UTC)
Groups: Registered
Posts: 25
We are using LEADTOOLS Document Imaging Suite 13.0 for the scanning functionality in our application.
When trying to save the scanned pages as a PDF file, we see the following script error:
The script engine: LEADRasterIO.LEADRasterIO.130
has reported the error: LEAD Error: PDF - Cannot insert, delete, append or replace pages
The statement that caused the error is: RasterIn.Save LEADRasterView1.Raster,AD.Field(“DetailL”),AD.Field(“
The PDF file gets saved successfully after hitting Ignore on this script error.
#2
Posted
:
Sunday, October 24, 2010 1:21:14 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Please send your LEADTOOLS v13 SDK serial number to
support@leadtools.com and ask for the latest patches for v13.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Tuesday, October 26, 2010 9:52:48 PM(UTC)
Groups: Registered
Posts: 25
I've downloaded and applied the patches, but still see the exact same error.
The scanned images are saved successfully into a single PDF file, so not sure why I should be seeing this script error.
#4
Posted
:
Wednesday, October 27, 2010 5:11:33 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Try to create a simple VB6 or .NET test program that has similar code and make it use the exact same parameters as your main application. Does it trigger the same problem? If yes, please send me this small program (NOT your full application) in a ZIP or RAR file. You can either post it here or email it to
support@leadtools.comThanks,
Maen Badwan
LEADTOOLS Technical Support
#5
Posted
:
Monday, November 8, 2010 9:36:54 PM(UTC)
Groups: Registered
Posts: 25
Ok, so we finally got the patches installed on the developer machine - by simply copying the files into the respective folders from the patch provided and then on the machine where the application is deployed - by taking the files from the Redist folder in the patch and distributing them using an installation utility.
Now, we see a license key error - image attached herewith.
Could you please advise us on what we may be missing?
J attached the following image(s):
#6
Posted
:
Tuesday, November 9, 2010 8:03:56 PM(UTC)
Groups: Registered
Posts: 25
Reapplied the patches and got rid of the license key error.
Now, I still see the same script error I started off with before this patch!
This is the VB Script being used to save the scanned images as PDF:
------------------------------------------------
' Refresh the image on the screen
LEADRasterView1.SetDstRect 0, 0, LEADRasterView1.ScaleWidth, LEADRasterView1.ScaleHeight
LEADRasterView1.SetDstClipRect 0, 0, LEADRasterView1.ScaleWidth, LEADRasterView1.ScaleHeight
' Load the file into a raster object
Set RasterIn = CreateObject("LEADRasterIO.LEADRasterIO")
' Quality of image (compression)
If &(2:) = 75 Then
' PNG
QFactor = 7
ElseIf &(2:) = 5 Then
' Lead CMP
QFactor = -4 ' Quality more important than size
ElseIf &(2:) = 10 or &(2:) = 11 or (&(2:) >= 20 and &(2:) = 150 and &(2:) = 146 and &(2:) <= 152 Then
LEADRasterView1.Raster.UnlockSupport 21, "key"
RasterIn.PDFSaveUseDPI = TRUE
End If
' Unlock Document Imaging if JBIG needed
If &(2:) = 115 or &(2:) = 139 Then
' JBIG - Unlock Document imaging
LeadRasterView1.Raster.UnlockSupport 0, "key"
End If
' Unlock TIFF LZW Support if needed
If &(2:) = 17 or &(2:) = 86 or &(2:) = 94 Then
LeadRasterView1.Raster.UnlockSupport 2, "JGgUy78FRRx"
End If
' Unlock GIF LZW Support if needed
If &(2:) = 2 Then
LeadRasterView1.Raster.UnlockSupport 1, "JnjmyyTss"
End If
RasterIn.Save LEADRasterView1.Raster, &(1:), &(2:), &(4:), QFactor, &(3:)
Set RasterIn = Nothing
LEADRasterView1.HScrollInfo.Pos = 0
LEADRasterView1.VScrollInfo.Pos = 0
------------------------------------------------
#7
Posted
:
Tuesday, November 9, 2010 9:02:35 PM(UTC)
Groups: Registered
Posts: 25
Parameters being:
1 = FullPath
=> Set to path with filename where scanned images are being saved/ or each page is appended
2 = leadFileConstants
=> Set to 'FILE_RAS_PDF_JPEG_411' (value 152)
3 = iModify
=> Set to Overwrite (value 0) for first scanned page, and then Append (value 1) for every other page
4 = BitDepth
=> Set to 4
-----------------------------------------------
I did find this in the Help File:
iModify
Indicates how to save a new page in a multipage file that supports insert and replace operations.
Value Meaning
SAVE_OVERWRITE [0] No insert/replace/append is performed. An existing file is overwritten. This is comparable to bMultipage being FALSE in earlier versions.
SAVE_APPEND [1] or [-1] The page is appended if the file exists. This is comparable to bMultipage being TRUE in earlier versions.
SAVE_REPLACE [2] Replace the page specified in the SavePage property.
SAVE_INSERT [3] Insert the new page before the page specified in the SavePage property
The following file formats support append operations:
TIFF (most TIFF formats, including JTIF but excluding EXIF)
PCX
FlashPix
AWD
Winfax
GIF
The following file formats support replace operations:
TIFF (most TIFF formats, including JTIF but excluding EXIF)
PCX
The following file formats support insert operations:
TIFF (most TIFF formats, including JTIF but excluding EXIF)
PCX
---------------------------------------------
There is no mention of PDF support for append operations here.
#8
Posted
:
Wednesday, November 10, 2010 12:28:36 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Appending to PDF works only when the PDF file was created using LEADTOOLS. You cannot append with v13 to a PDF that was created outside our toolkit.
If you still have the problem, please try to reproduce it in a small test project (preferably VB6 and not scripting language) and send it to
support@leadtools.com with a link to this forum thread.
Note:
Do NOT post code that contains any serial numbers or unlock keys on the public forums.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#9
Posted
:
Wednesday, November 10, 2010 1:15:52 AM(UTC)
Groups: Registered
Posts: 25
I don't get it. The script I posted above should be the only one creating the PDF, and then appending every other scanned page to it.
#10
Posted
:
Wednesday, November 10, 2010 1:33:33 AM(UTC)
Groups: Registered
Posts: 25
Sorry, I'm new to this.
Could you give me an example of how to create a PDF using LEADTOOLS, please?
#11
Posted
:
Wednesday, November 10, 2010 2:13:16 AM(UTC)
Groups: Registered
Posts: 25
Great, so it does turn out that a PDF file was first being generated using the default PDF Printer.
The first scanned page was being saved using 'Overwrite' and subsequent pages with 'Append'. Hence, the error, as Maen pointed out "You cannot append with v13 to a PDF that was created outside our toolkit"!
LEADTOOLS Support
Document
Document SDK Questions
Re: Script error when saving scanned images as PDF
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.