Annotation are not coming in print document - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF

TOPIC: Annotation are not coming in print document

Annotation are not coming in print document 2 years 7 months ago #10467

  • arcmobile.div
  • arcmobile.div's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 80
  • Thank you received: 0
Hello,

I have drawn annotations on a PDF Document ,Which is created by radaeepdf Android SDK , After drawing the annotation i have taken out a print of the document but print out is coming without the annotations .Please give a solution of it .It is a urgent issue for us.

Thanks
Sourav
Attachments:

Please Log in or Create an account to join the conversation.

Annotation are not coming in print document 2 years 7 months ago #10468

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 571
  • Karma: 6
  • Thank you received: 46
What are you using as printing device?
Are you printing with MacOS (which app)? Windows (which app)? Android or iOS?

If the third, may you poste your printing code?

Are you experiencing the issue on every printer or with a specific printer?

Please Log in or Create an account to join the conversation.

Annotation are not coming in print document 2 years 7 months ago #10469

  • arcmobile.div
  • arcmobile.div's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 80
  • Thank you received: 0
We are using HP printer .

We are using Android devices to print the PDF documrnt..



Below is the code block

MyActivity.java
PrintManager printManager = (PrintManager) mContext.getSystemService(Context.PRINT_SERVICE);
String jobName = "application_name" + " Document";
printManager.print(jobName, new PrintDocumentAdapter(mContext, mFilePathFile), null);

PrintDocumentAdapter.java

public class PrintDocumentAdapter extends PrintDocumentAdapter {
//All Variables

public PrintDocumentAdapter(Context context, File pdfFile1) {
this.context = context;
pdfFile = pdfFile1;
}

@Override
public void onStart() {
// TODO Auto-generated method stub
super.onStart();
}

@Override
public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes,
CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle metadata) {
myPdfDocument = new PrintedPdfDocument(context, newAttributes);
//totalpages = computePDFPageCount(pdfFile);


try {
PdfRenderer renderer = new PdfRenderer(ParcelFileDescriptor.open(pdfFile, ParcelFileDescriptor.MODE_READ_ONLY));
totalpages = renderer.getPageCount();

} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


if (cancellationSignal.isCanceled()) {
callback.onLayoutCancelled();
return;
}
if (totalpages > 0) {
PrintDocumentInfo.Builder builder = new PrintDocumentInfo.Builder(pdfFile.getName()).setContentType(
PrintDocumentInfo.CONTENT_TYPE_PHOTO).setPageCount(totalpages);

PrintDocumentInfo info = builder.build();
callback.onLayoutFinished(info, true);
} else {
callback.onLayoutFailed("Page count is zero.");
}

}

@Override
public void onWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal,
WriteResultCallback callback) {
InputStream input = null;
OutputStream output = null;

try {
input = new FileInputStream(pdfFile);
output = new FileOutputStream(destination.getFileDescriptor());
byte[] buf = new byte[1024];
int bytesRead;

while ((bytesRead = input.read(buf)) > 0) {
output.write(buf, 0, bytesRead);
}
callback.onWriteFinished(new PageRange[]{PageRange.ALL_PAGES});

} catch (FileNotFoundException ee) {
// Catch exception
// mPrintCompleteService.onMessage(Constants.PRINTER_STATUS_CANCELLED);
} catch (Exception e) {
// Catch exception
// mPrintCompleteService.onMessage(Constants.PRINTER_STATUS_CANCELLED);
} finally {
try {
input.close();
output.close();
} catch (IOException e) {
e.printStackTrace();
// mPrintCompleteService.onMessage(Constants.PRINTER_STATUS_CANCELLED);
}
}

cancellationSignal.setOnCancelListener(new CancellationSignal.OnCancelListener() {
@Override
public void onCancel() {
// mPrintCompleteService.onMessage(Constants.PRINTER_STATUS_CANCELLED);
}
});
}
@Override
public void onFinish() {
// TODO Auto-generated method stub
super.onFinish();
}
}


For reference developer.android.com/intl/zh-tw/referen...DocumentAdapter.html



.

Please Log in or Create an account to join the conversation.

Annotation are not coming in print document 2 years 7 months ago #10470

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 571
  • Karma: 6
  • Thank you received: 46
May you check the pdf files I'm attaching?
I've just printed using Nexus6 6.0.1 and none of the annotations was available on the output.

The files was modified and resaved using MacOSX Preview and Acrobat Pro.

It seems the issue is on printing driver.
Attachments:

Please Log in or Create an account to join the conversation.

Annotation are not coming in print document 2 years 7 months ago #10471

  • arcmobile.div
  • arcmobile.div's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 80
  • Thank you received: 0
We are generating the annotations by Radaee code and printing the PDF document by Android code.

Please check the image it is not showing any annotation on Print Preview of PDF Document but Document has few annotations.

Is there any way to let the annotations come on the Print Preview of PDF document . As we are thinking if annotations are coming on print preview we can expect they will come on printed document.
Attachments:

Please Log in or Create an account to join the conversation.

Annotation are not coming in print document 2 years 7 months ago #10472

  • arcmobile.div
  • arcmobile.div's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 80
  • Thank you received: 0
We are testing the issue with android and windows environment .

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum