Results 1 to 3 of 3

Thread: Open een PDF bestand op een android device

  1. #1

    Open een PDF bestand op een android device

    Nadat ik Delphi 10.3 Rio heb geinstaleerd loop ik tegen verschillende problemen aan met mijn projectje. Ik kom er maar niet achter hoe ik een PDF-bestand open in Android. Wat voorheen zo simpel was is nu wel heel ingewikkeld geworden. Ik heb verschillende oplossingen geprobeerd.
    Het uitgebreidste voorbeeld (met foto's en kant en klare bestanden);
    https://stackoverflow.com/questions/...ile-delphi-rio

    Als ik het onderste project van Dave Nottage download lukt het mij ook niet. Ik krijg dan de volgende foutmelding;

    [DCC Error] E2597 C:\Users\Public\Documents\Embarcadero\Studio\20.0\ CatalogRepository\AndroidNDK-17b_20.0.34749.6593\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: cannot open linker script file \\OpenPDFTest\\Android\\Debug\\OpenPDFTest.vsr: No such file or directory

    Moet ik er wel bijzeggen dat ik eigenlijk niet zo goed weet in welk mapje ik de " provider_paths.xml file " moet stoppen, want als ik het project van Dave begin heeft delphi nog niet de android map aangemaakt.

    Heeft iemand een idee ?

  2. #2
    Liep hier onlangs ook tegenaan (Ik draai Rio 10.3.3, heb het als volgt opgelost:
    - Alle Android-Manifest xml-files verwijderen uit project (staan op diverse locaties, allemaal weg, worden bij compileren opnieuw aangemaakt)
    - In Project, Options, EntitlementList: SecureFileSharing True zetten.
    - Vergeet de provider_paths.xml file, is in Rio 10.3.3 niet nodig.

    In code:
    procedure TMainForm.DocumentsListBoxItemClick(const Sender: TCustomListBox;
    const Item: TListBoxItem);
    var
    cGetFileName: String;
    cSaveFileName: String;
    cExtension: String;
    cApplication: String;
    {$ifdef Android}
    LIntent: JIntent;
    LUri: Jnet_Uri;
    {$endif}
    begin
    // Filename and Extension
    cGetFileName := TListBoxItem(DocumentsListBox.ItemByIndex(Document sListBox.ItemIndex)).ItemData.Text;
    cExtension := Lowercase(ExtractFileExt(cGetFileName));

    if pos('.', cExtension) > 0 then
    Delete(cExtension, pos('.', cExtension), 1); // Remove leading dot;

    cSaveFileName := System.IOUtils.TPath.GetTempPath + PathDelim + cGetFileName;

    // Get the file from Remote server
    if not FileExists(cSaveFileName) then
    SaveStreamToFile(GetRemoteWorkOrderServer.GetOrder File(OrderID, cGetFileName), cSaveFileName);

    if FileExists(cSaveFileName) then
    begin
    {$ifdef mswindows}
    ShellExecute(0, 'Open', PChar(cSaveFileName), '', '', SW_SHOWNORMAL);
    {$endif}

    // Need a PDF viewer installed on device in order for this to work
    {$ifdef Android}
    if cExtension = 'pdf' then
    cApplication := 'application/pdf'
    else
    if cExtension = 'doc' then
    cApplication := 'application/msword'
    else
    if cExtension = 'xls' then
    cApplication := 'application/vnd.ms-excel'
    else
    if cExtension = 'ppt' then
    cApplication := 'application/vnd.ms-powerpoint'
    else
    if cExtension = 'docx' then
    cApplication := 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
    else
    if cExtension = 'xlsx' then
    cApplication := 'application/vnd.ms-excel'
    // cApplication := 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    else
    if cExtension = 'pptx' then
    cApplication := 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
    else
    cApplication := 'image/*';

    LUri := TAndroidHelper.JFileToJURI(TJFile.JavaClass.init(S tringToJString(cSaveFileName)));
    LIntent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_ VIEW);
    LIntent.setDataAndType(LUri, StringToJString(cApplication));
    LIntent.setFlags(TJIntent.JavaClass.FLAG_GRANT_REA D_URI_PERMISSION);
    TAndroidHelper.Activity.startActivity(LIntent);
    {$endif}
    end;
    end;

  3. #3
    Dank je wel theMadman, ik ga deze zeker even uit proberen.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •