Skip to content

Created PDF doesn't contain texts #7

@klemikaze

Description

@klemikaze

Sometimes the PDF produced contains images (and correct CSS styling), but no text, in 90% of runs the PDF produced is correct and contains all information needed.
The problem is more often in Android 9.0, min sdk is 23, where the app works correctly 100%.
TBH I'm quite bamboozled here. No error is shown, the app doesn't stuck.
DataObject dto = createNewDataObject(); String html = Mustache.compiler().compile(AssetLoader.GetAcceptProtocolLayoutPage(getContext())).execute(dto); final WebView pdfWebView = (WebView) view.findViewById(R.id.pdfWebView); pdfWebView.setVisibility(View.VISIBLE); pdfWebView.loadDataWithBaseURL("file:///android_asset/", html, "text/html", "UTF-8", ""); pdfWebView.setWebViewClient(new WebViewClient() { @Override public void onPageCommitVisible(WebView view, String url) { final File directory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS + "/PCI_PDF/"); final String tempName = "PCI_temp.pdf"; File tmpFile = new File(directory.getAbsolutePath() + "/" + tempName); if (tmpFile.exists()) tmpFile.delete(); createWebPrintJob(getActivity(), pdfWebView, directory, tempName, new PdfView.Callback() { @Override public void success(String path) { String fileName = "PCI_" + System.currentTimeMillis() + ".pdf"; addPageFooters(directory.getAbsolutePath() + "/" + tempName, directory.getAbsolutePath() + "/" + fileName, pageFooter); Intent intent = new Intent(getContext(), ActivitySendPdf.class); intent.putExtra("pdfname", fileName); getActivity().startActivityForResult(intent, 10); }); } });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions