Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, February 27, 2015 11:43:38 AM(UTC)
kevinhint

Groups: Registered
Posts: 8


I have lots of blank forms in Pdf (with lines, boxes, etc) that get electronically filled in and converted to Tiffs. This worked fine under v15 but since moving to v18, a few forms aren't drawing all the lines. Attached are a couple of blank pdf forms, the resulting tiffs and a couple of code samples of how I'm doing it. Both samples work under v15 (with startup() calls, etc) but not v18.

Anybody have an ideas?
File Attachment(s):
MissingLines.zip (900kb) downloaded 29 time(s).
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, March 2, 2015 12:26:27 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

I checked your code and noticed that you have two custom methods as follows:
- ConvertPdfToTiff
- Resize14To11

Can you send me a code snippet that shows how exactly do you call these methods?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Monday, March 2, 2015 5:14:07 AM(UTC)
kevinhint

Groups: Registered
Posts: 8


TIFPageManager.ConvertPdfToTiff(@"C:\dev\PDF\", @"GDIS-Enroll-76822.pdf");

TIFPageManager.Resize14To11(@"C:\dev\PDF", new string[] { @"GDIS-Enroll-76822.pdf" }, @"C:\dev\PDF\out2.tif");
 
#4 Posted : Tuesday, March 3, 2015 1:40:01 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

You mentioned that the blank PDF files get electronically filled-in and converted to Tiffs. I checked your code and I am not sure yet where exactly the PDF files get filled in the code.

Can you send me two screenshots that show the differences between the black PDF file and the result TIFF file when using LEADTOOLS v18?

Also, what is the build number (file version info) of Leadtools.dll that you use?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Tuesday, March 3, 2015 4:52:59 AM(UTC)
kevinhint

Groups: Registered
Posts: 8


This code doesn't fill in the forms. I was just giving you some context. the zip contains pdf and tif pairs that should that even the blank form doesn't get drawn correctly.
 
#6 Posted : Tuesday, March 3, 2015 4:54:17 AM(UTC)
kevinhint

Groups: Registered
Posts: 8


version # is 18.0.0.18. I'm using the .net 4.0 platform.
 
#7 Posted : Tuesday, March 3, 2015 9:38:03 AM(UTC)

JustinF  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

kevinhint,

I was able to convert your PDFs to TIFFs properly, with all lines being drawn, by running the AutoBinarizeCommand on the RasterImage returned by Codecs.Load() in your ConvertPdfToTiff() method.

Here's a code snippet. It starts at the beginning of the try block.

--------------------------------------------------

codecs = new RasterCodecs();

//codecs.Options.Pdf.Load.XResolution = 200;
//codecs.Options.Pdf.Load.YResolution = 200;

image = codecs.Load(pdfFile.ToString());
image.XResolution = 200;
image.YResolution = 200;

AutoBinarizeCommand autoBinarizeCommand = new AutoBinarizeCommand();

autoBinarizeCommand.Run(image);

MemoryStream memoryStream = new MemoryStream();

codecs.Save(image, memoryStream, RasterImageFormat.CcittGroup4, 1);

--------------------------------------------------

Hope that helps!
 
#8 Posted : Tuesday, March 3, 2015 9:41:26 AM(UTC)

JustinF  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Also, here is some documentation on the command:

https://www.leadtools.com/help/leadtools/v18/dh/po/leadtools.imageprocessing.core~leadtools.imageprocessing.core.autobinarizecommand.html

https://www.leadtools.com/sdk/image-processing/functions/function.asp?id=203
 
#9 Posted : Tuesday, March 3, 2015 9:58:06 AM(UTC)
kevinhint

Groups: Registered
Posts: 8


That seems to do the trick. I'm having my customer sign off on it but it looks good to me. I noticed it says it part of the "medical" sdk. I didnt get any license popup so I assume I have the right license (???) Which unlock covers this feature?
 
#10 Posted : Tuesday, March 3, 2015 10:00:58 AM(UTC)
kevinhint

Groups: Registered
Posts: 8


Also, in my other method that does the resizing, etc, is there a suggested order to do ResizeCommand, CombineFastCommand and this AutoBinarizeCommand? Performance-wise?
 
#11 Posted : Tuesday, March 3, 2015 10:21:51 AM(UTC)

JustinF  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/CS/Themes/default/images/icon-quote.gif">&nbsp;<strong>kevinhint wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">That seems to do the trick. I'm having my customer sign off on it but it looks good to me. I noticed it says it part of the "medical" sdk. I didnt get any license popup so I assume I have the right license (???) Which unlock covers this feature?</td></tr></table></td></tr></table></BLOCKQUOTE>

You just need the Document Imaging SDK OR the Medical SDK, but not both.

<BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/CS/Themes/default/images/icon-quote.gif">&nbsp;<strong>kevinhint wrote:</strong></td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4">Also, in my other method that does the resizing, etc, is there a suggested order to do ResizeCommand, CombineFastCommand and this AutoBinarizeCommand? Performance-wise?</td></tr></table></td></tr></table></BLOCKQUOTE>

I'll do some long running time trials. Give me a few minutes....
 
#12 Posted : Tuesday, March 3, 2015 10:26:52 AM(UTC)
kevinhint

Groups: Registered
Posts: 8


I've got DOCUMENT so I'm covered. Turns out there's only one order that works for the resizing so that solves that. ;)

The resize method is pretty old code. Can you suggest any faster way to do that? This code is taking about 2.3 sec/each.
 
#13 Posted : Tuesday, March 3, 2015 11:24:44 AM(UTC)

JustinF  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

kevinhint,

I would recommending trying the RasterImageResize class. I compared its speed to ResizeCommand, and the act of scaling one of your PDFs by a factor of 0.5 was ~25x faster using RasterImageResize (4 ms vs 100+ ms).

This might not be a universal truth, and its also going to be machine dependent, but I would give this alternative a shot.

Here's a code snippet:

---------------------------------------------------------------

string directory = @"C:\Users\justinf\Downloads\MissingLines\";
string pdf = @"LifeApp08-68509.pdf";
string destFileName = directory + "test.tif";
RasterCodecs codecs = new RasterCodecs();
RasterImage srcImage = codecs.Load(directory + pdf);

int destWidth = srcImage.Width / 2;
int destHeight = srcImage.Height / 2;

RasterImage destImage = new RasterImage(RasterMemoryFlags.Conventional,
destWidth,
destHeight,
srcImage.BitsPerPixel,
srcImage.Order,
srcImage.ViewPerspective,
srcImage.GetPalette(),
IntPtr.Zero,
0);


RasterImageResize resize = new RasterImageResize();

byte[] buffer = new byte[destImage.BytesPerLine];

// Start the resize process
resize.Start(
srcImage,
destWidth,
destHeight,
srcImage.BitsPerPixel,
srcImage.Order,
srcImage.DitheringMethod,
RasterSizeFlags.None,
srcImage.GetPalette());

destImage.Access();
// get the rows for the resized image, one by one
for (int row = 0; row < destImage.Height; row++)
{
resize.ResizeBuffer(row, 0, buffer, 0, destImage.BytesPerLine);
destImage.SetRow(row, buffer, 0, destImage.BytesPerLine);
}
destImage.Release();
resize.Stop();




// Save the destination image
codecs.Save(destImage, destFileName, RasterImageFormat.CcittGroup4, 1);

---------------------------------------------------------------

If speed is still an issue, you may want to consider parallel computing using the LEADTOOLS Distributed Computing SDK to handle jobs in parallel on multiple machine. The Distributed Computing SDK is available as an add on to our Document Imaging SDK.

https://www.leadtools.com/sdk/distributed-computing/default.htm
 
#14 Posted : Tuesday, March 3, 2015 11:27:05 AM(UTC)

JustinF  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

RasterImageResize documentation:

https://www.leadtools.com/help/leadtools/v18/dh/l/leadtools~leadtools.rasterimageresize.html
 
#15 Posted : Wednesday, March 4, 2015 6:19:44 AM(UTC)
kevinhint

Groups: Registered
Posts: 8


Looks like that autoBinarizeCommand only works on 1 page at a time, true? Is there a way to do a multi-page doc all at once or do I just loop through them?
 
#16 Posted : Wednesday, March 4, 2015 7:05:22 AM(UTC)

JustinF  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

Yes, you can use the RastetCommandProcessor to perform batch image processing.

https://www.leadtools.com/help/leadtools/v18/dh/l/leadtools~leadtools.imageprocessing.rastercommandprocessor.html
 
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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.126 seconds.