ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Convert a PDF to TIFF
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

michaeldca

Brazil
8 Posts

Posted - Dec 06 2016 :  13:15:26  Show Profile  Reply
Good afternoon! I need to do the conversion of a PDF file into TIFF, know the color used and break this file into several pages.

Which of the components do I use to do this?

Hugs.

Michael

xequte

38610 Posts

Posted - Dec 06 2016 :  15:20:55  Show Profile  Reply
Hi Michael

To read the PDF you will need to use ImageMagick+GhostScript or the new WPViewPDF plug-in:

http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=2744


Other than that, everything you need is built into ImageEn.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

michaeldca

Brazil
8 Posts

Posted - Dec 12 2016 :  13:29:16  Show Profile  Reply
Actually, that's not quite what I wanted. I think I expressed myself poorly.

I need to know the size and color of a TIFF, whether it is colored, grayscale or black and white.

Then convert it to PDF.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Dec 13 2016 :  09:46:02  Show Profile  Reply
There are no built-in functions to achieve this so we will build our own function.
type
  TIEColorType = (ieGrayScale, // grayscale
    ieBlackWhite, // black and white
    ieColor, // colored
    ieUnknown);

function GetColorType(AIEBitmap: TIEBitmap): TIEColorType;
begin
  if AIEBitmap.Bitcount = 1 then
    Result := ieBlackWhite
  else if AIEBitmap.IsGrayScale then
    Result := ieGrayScale
  else if AIEBitmap.PaletteUsed > 2 then
    Result := ieColor
  else
    Result := ieUnknown;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenPictureDialog1.Execute then
  begin
    ImageEnView1.IO.LoadFromFile(OpenPictureDialog1.FileName);
    ImageEnView1.Update;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ImageEnView1.Proc.ConvertToGray;
  ImageEnView1.Update;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  ImageEnView1.Proc.ConvertToBWOrdered;
  ImageEnView1.IEBitmap.Bitcount := 1;
  ImageEnView1.Update;
end;

procedure TForm1.Button4Click(Sender: TObject);
var
  ieColorType: TIEColorType;
  iColor: string;
begin
  ieColorType := GetColorType(ImageEnView1.IEBitmap);
  case ieColorType of
    ieGrayScale:
      iColor := 'grayscale.';
    ieBlackWhite:
      iColor := 'black and white.';
    ieColor:
      iColor := 'colored.'
  end;
  MessageBox(0, PChar('The bitmap is ' + iColor), 'Color',
    MB_ICONINFORMATION or MB_OK);
end;

This is only one way to achieve this so other options may work as well.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

michaeldca

Brazil
8 Posts

Posted - Dec 13 2016 :  14:51:17  Show Profile  Reply
Thank you! Now, how can I convert PDF to TIFF and do these checks?
Go to Top of Page

xequte

38610 Posts

Posted - Dec 18 2016 :  19:11:10  Show Profile  Reply

MBitmap := TIEMultiBitmap.create;
MBitmap.Read( 'D:\myPDF.pdf' );
MBitmap.Write( 'D:\myTIFF.tiff' );
MBitmap.Free();


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

w2m

USA
1990 Posts

Posted - Dec 19 2016 :  12:55:55  Show Profile  Reply
See the new WPCubed Plugin Demo for details on how to load PDF file, change image colors and export to tiff file:
http://www.imageen.com/ieforum/topic.asp?whichpage=6&TOPIC_ID=1446#10655

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: