tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
3
ZUGRIFFE
2706
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    BMo BMo ist offline Mitglied Silber
    Registriert seit
    Jan 2004
    Beiträge
    89
    Blog-Einträge
    1
    Hi,
    ich verfolge folgendes Ziel: Ich möchte ein PDF mit dem HTMLLoader einlesen und
    die erste Seite als JPG speichern. Einlesen und Anzeigen ist kein Problem. Das speichern auch nicht, nur ist der Teil des Bildes, an dem das PDF sein sollte einfach nur grau.

    Gewünschtes Ergebnis siehe Bild 1, leider kommt nur Bild 2 raus. Ich hab es schon mit cacheAsBitmap versucht, aber geht auch nicht.
    Hat sonst jemand eine Idee?

    Danke!

    Grüße
    Miniaturansicht angehängter Grafiken Miniaturansicht angehängter Grafiken HTMLLoader bleibt grau bei BitmapData draw-1.jpg   HTMLLoader bleibt grau bei BitmapData draw-2.jpg  

     

  2. #2
    BMo BMo ist offline Mitglied Silber
    Registriert seit
    Jan 2004
    Beiträge
    89
    Blog-Einträge
    1
    Kann mir niemand helfen?
    Kann auch gern den Code veröffentlichen, wenn nötig.
     

  3. #3
    Avatar von tobee
    tobee tobee ist offline Grolba.com media
    Registriert seit
    Jul 2005
    Ort
    Karlsruhe
    Beiträge
    1.700
    Blog-Einträge
    131
    Dann man das bitte, danke .
     

  4. #4
    BMo BMo ist offline Mitglied Silber
    Registriert seit
    Jan 2004
    Beiträge
    89
    Blog-Einträge
    1
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    
    import flash.display.BitmapData;
    import flash.display.StageScaleMode;
    import jpgencoder.*;
     
    Stage["showMenu"]=false;
    stage.scaleMode=StageScaleMode.NO_SCALE;
     
    var pdf:HTMLLoader;
     
    function init():void {
        if (HTMLLoader.pdfCapability==HTMLPDFCapability.STATUS_OK) {
            pdf = new HTMLLoader();
            var url:URLRequest=new URLRequest("app:/test.pdf");
            pdf.height=500;
            pdf.width=700;
            pdf.load(url);
            this.pdfEbene.addChild(pdf);
            this.cacheAsBitmap=true;
     
        }
        this.saveImg.addEventListener('click',function(){;
        pdfLoaded();
        });
        if (HTMLLoader.pdfCapability==HTMLPDFCapability.ERROR_INSTALLED_READER_NOT_FOUND) {
            trace("No reader found");
        }
        if (HTMLLoader.pdfCapability==HTMLPDFCapability.ERROR_INSTALLED_READER_TOO_OLD) {
            trace("Reader is too old");
        }
        if (HTMLLoader.pdfCapability==HTMLPDFCapability.ERROR_PREFERRED_READER_TOO_OLD) {
            trace("Reader is too old");
        }
    }
     
    function pdfLoaded():void {
        var BMPData:BitmapData=new BitmapData(this.pdfEbene.width,this.pdfEbene.height);
        BMPData.draw(this.pdfEbene);
        //create a new instance of the encoder, and set the jpeg compression level from 0 to 100
        var jpgenc:JPEGEncoder=new JPEGEncoder(100);
        //encode the bitmapdata object and keep the encoded ByteArray
        var imgByteArray:ByteArray=jpgenc.encode(BMPData);
        //gets a reference to a new empty jpg image file in user desktop
        var fl:File=File.desktopDirectory.resolvePath("snapshot.jpg");
        //Use a FileStream to save the bytearray as bytes to the new file
        var fs:FileStream = new FileStream();
        try {
            //open file in write mode
            fs.open(fl,FileMode.WRITE);
            //write bytes from the byte array
            fs.writeBytes(imgByteArray);
            //close the file
            fs.close();
        } catch (e:Error) {
            trace(e.message);
        }
    }
     
    init();
     

Ähnliche Themen

  1. Array mit BitmapData-Objekten anlegen
    Von Marius Heil im Forum Flash Plattform
    Antworten: 2
    Letzter Beitrag: 19.05.09, 00:39
  2. JEditorPane bleibt grau?
    Von Maik20 im Forum Swing, Java2D/3D, SWT, JFace
    Antworten: 4
    Letzter Beitrag: 01.10.08, 07:53
  3. BitmapData und Threshold Bildanalyse?
    Von spuncky im Forum Flash Plattform
    Antworten: 0
    Letzter Beitrag: 16.09.08, 22:06
  4. 3D Fenster bleibt grau
    Von Caliban2k6 im Forum Cinema 4D
    Antworten: 6
    Letzter Beitrag: 21.06.07, 16:40
  5. grau weiss grau tabelle?
    Von asdfg im Forum PHP
    Antworten: 19
    Letzter Beitrag: 05.03.06, 10:44