- Posts: 80
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
Annotation are not coming in print document
- arcmobile.div
- Topic Author
- Offline
- Premium Member
-
Less
More
9 years 11 months ago #10467
by arcmobile.div
Annotation are not coming in print document was created by arcmobile.div
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
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
9 years 11 months ago #10468
by support
Replied by support on topic Annotation are not coming in print document
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?
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?
- arcmobile.div
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 80
- Thank you received: 0
9 years 11 months ago #10469
by arcmobile.div
Replied by arcmobile.div on topic Annotation are not coming in print document
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
.
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
.
9 years 11 months ago #10470
by support
Replied by support on topic Annotation are not coming in print document
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.
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.
- arcmobile.div
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 80
- Thank you received: 0
9 years 11 months ago #10471
by arcmobile.div
Replied by arcmobile.div on topic Annotation are not coming in print document
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.
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.
- arcmobile.div
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 80
- Thank you received: 0
9 years 11 months ago #10472
by arcmobile.div
Replied by arcmobile.div on topic Annotation are not coming in print document
We are testing the issue with android and windows environment .
Time to create page: 0.449 seconds