1

I just started using Magick.net, but this is not my first time see'ing ImageMagick sence some time ago I've played with it and managed to do this:

@echo off
setlocal


::--------------------------------------------------------
   ::PDF File location
Set "PDFDir=C:\PDF"
   ::ImageMagick version
   ::32 or 64
Set "IMv=32"

::--------------------------------------------------------
   :: Batch file location
Set "eXeDir=%~dp0"
::--------------------------------------------------------
   ::First Text
Set "Text1=C.O.O.L."
   :: First Text Font
Set "Font1=Arial"
::--------------------------------------------------------
   ::Second Text
Set "Text2=This is a super cool text on a super cool pdf file writen by:"
   :: Second Text Font
Set "Font2=Arial-Narrow"
::--------------------------------------------------------
   ::3rd Text
Set "Text3=ME!"
   :: 3rd Text Font
Set "Font3=Arial"
::--------------------------------------------------------


echo Just wait while I write in here.
  for %%F in ("%PDFDir%\*.pdf") do (
   rem echo "%%~nxF"
   "%eXeDir%\gs\bin\gswin32c.exe" -q -dNOPAUSE -r200 -sDEVICE=tiffgray -sOutputFile="%eXeDir%\temp\temp.tif" "%%F" -c quit
::  -strip -quality 90 to lower quality 
   "%eXeDir%\ImageMagick%IMv%\convert.exe" "%eXeDir%\temp\temp.tif" -font %Font1% -pointsize 200 -strokewidth 3 -draw "gravity north fill none stroke gray text 0,9  '%Text1%'" -font %Font2% -pointsize 80 -strokewidth 2 -draw "gravity center fill none stroke gray rotate -45 text 0,9 '%Text2%'" -font %Font3% -pointsize 200 -strokewidth 3 -draw "gravity south fill none stroke gray text 0,9  '%Text3%'" -compress jpeg  "%PDFDir%\%%~nxF" 
)

Pause. >nul | echo. All Done here.

Converting a pdf file to a multipage Tiff and then draw on the tiff and then convert it back to a pdf.... I am hoping that there is a better way of doing this , sence I want to change the font size for A3 pages and Landscape/Portrait and want to keep it as clean as posible.
While playing with the ghithub documentation Ive tried this:

    using (MagickImage image = new MagickImage(@"H:\\Test\Project C\bin\Debug\cool2.pdf"))
    {
        new Drawables()
          // Draw text on the image
          .Font("Arial")
          .FontPointSize(200)
          .StrokeWidth(3)
          .StrokeColor(new MagickColor("gray"))
          .FillColor(MagickColors.None)
          .Gravity(Gravity.North)
          .TextAlignment(TextAlignment.Center)
          .Text(300, 100, "C.O.O.L")
          .Draw(image);

        image.Format = MagickFormat.Pdfa ;
        image.Write("sdas" + ".pdf");

but it doesnt do the trick.

0 Answers0