[WE] How to display PDF and JPG ?

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Wed Jun 22 17:14:41 CDT 2011


Hi All,

We have try to make example with Valentina Reports in
    REALbasic + WEB mode ...

All looks in general good. PDF and JPG are created correctly right near to
app. But we cannot find way to display them.

Code looks as below.

PROBLEMs ARE: 

A) PDF is loaded into HTMLViewer1 just as a lots of SYMBOLS.

B) JPG is shown as white area.  Although JPG on disk is correct. Bug?


We have try to use 
    HTMLViewer1 .URL = UrlToAnyPdfFromInet

And this works ... PDF is shown ... But a lots of visual glitches btw, if
try to scroll it by mouse  ...

Anybody see mistakes in code?


==========================
  CreateDB()
  OpenProject()
  
  mReport = mProject.MakeNewReport(  1, mDatabase, "SELECT * FROM T1"  )
  
  if mReport <> nil then
    dim f as folderItem
    dim f2 as FolderItem
    
    // Create temporary file
    f = GetFolderItem("report.pdf" )
    f2 = GetFolderItem("report.jpg" )
    
    
    // MAKE  PDF on disk.
    mReport.PrintToDisk( f, EVReportPrintType.kToPDF, 1 )
    mReport.PrintToDisk( f2, EVReportPrintType.kToPicture_JPG, 1 )
    
    // ------------------------
    // READ PDF to String
    dim str as String
    dim bs as BinaryStream
     
    //make sure it exists before we try to read it
    if f.exists then
      
      //open the folderitem as a binary file without write privelages
      //     To open with write privelages, use true instead of false
      bs=BinaryStream.Open(f,False)
      
      //make sure we have a binary stream to read from
      if bs <> nil then
        
        //read the whole binaryStream
        str = bs.read(bs.length)
        
        //close the binaryStream
        bs.close
      end if
    end if
    
    
    HTMLViewer1.LoadPage( str )   //  PDF
    ImageView1.Picture = Picture.Open( f2 )  // JPG
    
  end if
=======================================




-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list