#1
Posted
:
Friday, June 8, 2018 11:33:35 AM(UTC)
Groups: Registered
Posts: 2
I am new to the Leadtools SDK. The shop is using Leadtools v15. I have trying to find documents/example 'How to' convert PDF and DOC, DOCX to Tiff files. But I find almost nothing related to this. Please help.
The code stops at _imageObject = _codecs.Load(_uldfile.InputStream). I think there is another way to load PDF file to _codecs but I don't know how.
Thanks.
Code:
Protected Sub UpdateFile()
Dim _uldfile As HttpPostedFile
Dim _int As Integer
Dim _fileName As String
Dim _fileExtension As String
Dim _uldFileName As String
Dim _NewTiffFileName As String
Dim _ErrMessage As String
Dim _codecs As Leadtools.Codecs.RasterCodecs = Nothing
Dim _imageObject As Leadtools.RasterImage = Nothing
For Each s As String In Request.Files
_uldfile = Request.Files(s)
_int = _uldfile.ContentLength
_fileName = _uldfile.FileName
_fileExtension = String.Empty
If Not (String.IsNullOrEmpty(_fileName)) Then
_fileExtension = System.IO.Path.GetExtension(_fileName)
End If
_uldFileName = System.Guid.NewGuid().ToString
_NewTiffFileName = Server.MapPath("~/UploadFiles/") & _uldFileName & ".tif"
Leadtools.Codecs.RasterCodecs.Startup()
_codecs = New Leadtools.Codecs.RasterCodecs()
Dim info As CodecsImageInfo
info = _codecs.GetInformation(_uldfile.InputStream, True)
If info.Format = Leadtools.RasterImageFormat.RasPdf Then
_imageObject = _codecs.Load(_uldfile.InputStream)
_codecs.Options.Pdf.Load.XResolution = info.XResolution
_codecs.Options.Pdf.Load.YResolution = info.YResolution
_codecs.Options.Tiff.Save.UsePhotometricInterpretation = True
_codecs.Options.Tiff.Save.PhotometricInterpretation = CodecsTiffPhotometricInterpretation.MinimumIsWhite
_codecs.Save(_imageObject, _NewTiffFileName, Leadtools.RasterImageFormat.Tif, 0, 1, -1, 1, CodecsSavePageMode.Overwrite)
Else
_imageObject = _codecs.Load(_uldfile.InputStream)
_codecs.Options.Save.UseImageDitheringMethod = True
_imageObject.DitheringMethod = Leadtools.RasterDitheringMethod.FloydStein
Try
_codecs.Save(_imageObject, _NewTiffFileName, Leadtools.RasterImageFormat.Tif, 32)
Catch ex As Exception
_ErrMessage = ex.Message
Finally
End Try
_imageObject.Dispose()
_codecs.Dispose()
End If
Next
End Sub
#2
Posted
:
Tuesday, June 12, 2018 9:22:56 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hello,
LEADTOOLS 15 does not have any support for rasterizing DOC/DOCX files. It would support converting PDF to TIFF files however. LEADTOOLS 15 predates our native office file rendering as well as the LEADTOOLS Virtual Printer driver that was used before native rendering. If you want to rasterize DOC & DOCX to convert to TIFF, you would need to upgrade your version of LEADTOOLS.
By upgrading to LEADTOOLS 20, you would also have access to our sample raster REST services. You could use those as-is or create one of your own if you wish.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
#3
Posted
:
Tuesday, June 12, 2018 5:20:48 PM(UTC)
Groups: Registered
Posts: 2
Will Leadtools V20 support DOC/DOCX to TIFF files?
Thanks.
#4
Posted
:
Wednesday, June 13, 2018 8:01:29 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Yes, LEADTOOLS 20 does provide native rendering for DOC & DOCX. You can download and install the latest evaluation to test this out. You can install it on the same machine as you currently have LEADTOOLS 15 on. The installations are set up so they shouldn't affect one another. I have both versions installed on my Windows 10 machine.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
#5
Posted
:
Friday, September 28, 2018 10:52:54 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 89
Was thanked: 4 time(s) in 4 post(s)
I would have to recommend using the
LEADTOOLS v20 SDK.
This is the latest released version of the SDK and has had a number of new features and capabilities included since the release of v15.
In the download, we do have a Document Converter demo.
This includes the source code used in creating the demo project.
It can easily serve as the base for your own application development, or as a working example to showcase the implementation of certain functionality.
The default file path location for this is listed below:
C:\LEADTOOLS 20\Shortcuts\Document Converter\.NET Framework Class Libraries
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.
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.