Page 23 of 32

Re: PurePDF Version 2.0

Posted: Sun Oct 06, 2013 8:09 am
by ABBKlaus
Please upload those images somewhere so that i can test whats going wrong.

Re: PurePDF Version 2.0

Posted: Sun Oct 06, 2013 1:53 pm
by StarBootics
ABBKlaus wrote:Please upload those images somewhere so that i can test whats going wrong.
I think I don't need to upload image, I have use the pdf_GetErrorMessage() to see what is going on.
Debugger wrote:Alpha channel PNG not supported.
And my first png logo use alpha channel. I have try to save my logo as jpeg image using "The Gimp" V2.8 and apparently if I use the "Progressive" option :
Debugger wrote:Not a JPEG file.
Apparently the Progressive image load for the web generate a bug. I hope this will help you to figure out this bug.

Regards
StarBootics

Re: PurePDF Version 2.0

Posted: Sun Oct 06, 2013 2:39 pm
by IdeasVacuum
see also Pages 18/19 of this post - there are a number of things to be aware of concerning image size and dpi.

Re: PurePDF Version 2.0

Posted: Sun Oct 06, 2013 7:23 pm
by ABBKlaus
ok progressive works now. please redownload the latest Version from my site ;-)

Code: Select all

Procedure ipdf_ParseJPG(*aData.MEM_DataStructure)  
  Protected vStart,vLength,vFound,vResult,vByte.b
  
  ;Block Length
  vLength = ((PeekB(*aData\pData + 4) & $FF)*$100) + (PeekB(*aData\pData + 5) & $FF)
  vStart = 4 + vLength     
  vFound = #False
  While (vFound <> #True) And (vStart + 9 < *aData\lCurSize)
    vByte=PeekB(*aData\pData + vStart) & $FF
    If vByte = -1
      vByte = PeekB(*aData\pData + vStart + 1) & $FF
      If (vByte = -64) Or (vByte = -62)
        vFound = #True
        Images()\Bpc = PeekB(*aData\pData + vStart + 4)
        Images()\Height = ((PeekB(*aData\pData + vStart + 5) & $FF)*$100) + (PeekB(*aData\pData + vStart + 6) & $FF)
        Images()\Width =  ((PeekB(*aData\pData + vStart + 7) & $FF)*$100) + (PeekB(*aData\pData + vStart + 8) & $FF)
        ; Gray = 1/Color = 3
        Select PeekB(*aData\pData + vStart + 9) & $FF
          Case 1
            Images()\ColSpace = "DeviceGray"
          Case 3
            Images()\ColSpace = "DeviceRGB"           
          Default:
            Images()\ColSpace = "DeviceCMYK"               
        EndSelect    
        Images()\DataPic\pData = *aData\pData
        Images()\DataPic\lCurSize = *aData\lCurSize
        vResult = #True
      Else
        ;Block Length
        vLength = ((PeekB(*aData\pData + vStart + 2) & $FF)*$100) + (PeekB(*aData\pData + vStart + 3) & $FF)
        vStart = vStart + vLength + 2
      EndIf      
    Else
      pdfError = #PDF_ERROR_JPEG_FILE_IS_NOT_SUPPORTED
      vResult = #False
      Break
    EndIf    
  Wend  
  ProcedureReturn vResult
EndProcedure

Re: PurePDF Version 2.0

Posted: Tue Oct 08, 2013 5:03 pm
by Lord
Hi!

Did I miss something or is it not possible to
include an image without saving it first to
HD an then reload this image?
pdf_Image() needs a path to an image. so
I can't use a drawing wich I want to include
in a pdf file.
A pdf_Image(#Img, ...) would be a nice feature.

Re: PurePDF Version 2.0

Posted: Tue Oct 08, 2013 9:39 pm
by ABBKlaus
Did you try pdf_ImageMem() ?

Its not possible with PureBasic commands to create a JPG or PNG in Memory. Maybe there´s an api way ?

[/Edit]Found it : *Buffer = EncodeImage(#Image [, ImagePlugin [, Flags [, Depth]]])[Edit]

Re: PurePDF Version 2.0

Posted: Tue Oct 08, 2013 9:46 pm
by Loopingstar
I give an example of "encodeImage" in another of my posts: http://www.purebasic.fr/english/viewtop ... 13&t=56927, with the help of Chris :)

Re: PurePDF Version 2.0

Posted: Wed Oct 09, 2013 8:15 am
by Lord
ABBKlaus wrote:...
[/Edit]Found it : *Buffer = EncodeImage(#Image [, ImagePlugin [, Flags [, Depth]]])[Edit]
Yup, that's the way to go.
I didn't know, that the path string in pdf_ImageMem() isn't relevant.
Thanks for this hint (and PurePDF anyway :D )
Loopingstar wrote:I give an example of "encodeImage" in another of my posts: http://www.purebasic.fr/english/viewtop ... 13&t=56927
Thank you for this additional example.

Re: PurePDF Version 2.0

Posted: Wed Oct 09, 2013 7:13 pm
by mcsalsa
Unicode for Japanese.

I am trying to use Japanese chars with PurePDF, I have followed the Tutorial regarding unicode and when printing a char like Chr(12452), with the font "Lucida Sans Unicode", compiler set to "Create Unicode Executable" I get a Square.

In order to check the problem if you use "XIncludeFile "Source\PurePDF.pb" then in the Debug window we see this error: "Font contains a broken glyph code mapping, ignored" ... someone has found the same trouble?

Thanks

Re: PurePDF Version 2.0

Posted: Wed Oct 09, 2013 7:27 pm
by IdeasVacuum
First thing to do then is try another font.........

Re: PurePDF Version 2.0

Posted: Wed Oct 09, 2013 8:35 pm
by ABBKlaus
There is no char in that font with $30A4 (12452) :wink:

What char do you want ?

Re: PurePDF Version 2.0

Posted: Fri Oct 11, 2013 2:13 pm
by ABBKlaus
Hi all,

i fixed two issue´s with unicode fonts. Please redownload the latest version from my website.
- ipdf_Handle_MS_Encoding() changed variable n.w to n.u
- ipdf_Handle_MS_Encoding() fixed broken glyph code detection

Re: PurePDF Version 2.0

Posted: Mon Oct 14, 2013 10:08 am
by Lord
Hi!

What went wrong here:

Code: Select all

#PurePDF_Include=1

;Put you path pointing to "PurePDF.pb" and "PurePDF.res" here:
IncludePath "....\PurePDF\Examples\PurePDF\"
;

XIncludeFile "PurePDF_res.pb"
XIncludeFile "PurePDF.pb"

Define Logo.s, myPath.s, Error.s
Define ImgW,i, ImgH.i
Define Quality.i
Define *myImgBuffer

UsePNGImageDecoder()
UseJPEGImageEncoder()

Logo.s=#PB_Compiler_Home+"Examples\3D\Data\PureBasic3DLogo.png"

;Put your path for PDF and JPG files here
myPath.s="...."
;

If LoadImage(1, Logo)
  ImgW=ImageWidth(1)
  ImgH=ImageHeight(1)
  For Quality= 0 To 10
  Debug "Loop start ---"
  *myImgBuffer=EncodeImage(1, #PB_ImagePlugin_JPEG, Quality)
  If *myImgBuffer
    Debug "Quality: "+Str(Quality)
    pdf_Create("P", "pt", Str(ImgW)+","+Str(ImgH))
    pdf_setmargins(0,0,0)
    pdf_AddPage()
    pdf_ImageMem("", *myImgBuffer, MemorySize(*myImgBuffer), 0, 0)
    Debug pdf_geterrormessage()
    pdf_Save(myPath+"\PDFTestQ"+Str(Quality)+".pdf")
    Debug pdf_geterrormessage()
    ; save JPG for reference purpose
    SaveImage(1 , myPath+"\JPGTestQ"+Str(Quality)+".jpg", #PB_ImagePlugin_JPEG, Quality)
    ;
    FreeMemory(*myImgBuffer)
  EndIf
  Debug "Loop end ----"
  Next Quality
EndIf
I'm getting a "Not a JPEG file."-Error for Quality settings 0 to 2.
SaveImage() doesn't complain for Quality=0 to Quality=2.

Re: PurePDF Version 2.0

Posted: Mon Oct 14, 2013 8:10 pm
by ABBKlaus
Hi Lord,
Thanks for beta testing ;-)

The Extended sequential DCT was missing.

I uploaded a bugfixed version here : http://www.purebasicpower.de/?download= ... B52X86.zip

Re: PurePDF Version 2.0

Posted: Thu Oct 17, 2013 6:14 am
by loulou
Hi ABBKlauss,
Is it possible to print an html file in pDF with PurePDF ? If no does-it exists something to do that except with Microsoft Office or Open Offce
Thanks in advance