Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7601835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:15:35+00:00 2026-05-30T23:15:35+00:00

I am developing an android application in eclipse to print a report via Google

  • 0

I am developing an android application in eclipse to print a report via Google Cloud Print.
This tutorial from Google has me on the right track.
I have already installed itext to generate the Report.pdf

My problem is in the “print” element of my applications UI. Google supplies this code:

Intent printIntent = new Intent(this, PrintDialogActivity.class);
printIntent.setDataAndType(docUri, docMimeType);
printIntent.putExtra("title", docTitle);
startActivity(printIntent);

With the message:

“In the code above, replace the three parameters as follows: docUri –
URI of the document to be printed docMimeType – MIME type of the
document to be printed. We recommend that you use PDF
(application/pdf) format docTitle – title of the printed document,
arbitrary string that will be shown on the GCP management console as
the print job’s title

My PDF is saved at /data/Student/StudentReportPDF.pdf

I have tried changing the docUri, docMimeType and docTitle has follows: With no luck

Intent printIntent = new Intent(this, PrintDialogActivity.class);
printIntent.setDataAndType(StudentReportPDF, .pdf);
printIntent.putExtra("title", Student Report);
startActivity(printIntent);

All 3 elements result in red squigglies.

Can someone spot my mistake or I guess clarify these 3 elements for me?

printing eclipse-plugin pdf-generation itext google-cloud-print

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:15:36+00:00Added an answer on May 30, 2026 at 11:15 pm

    Big thanks to DragonRancher via Reddit

    dragonrancher 1 point 1 hour ago
    When using the Java language, you need to put your strings between double quotes, otherwise they are interpreted as identifiers.
    Your putExtra line should probably look like:

    printIntent.putExtra("title", "Student Report");
    

    The setDataAndType line has other issues though. According to the documentation, the setDataAndType method requires a Uri object and a string containing a MIME type. In this case, you might be able to use the Uri.fromFile or Uri.parse methods to get a Uri object from your filename, and the MIME type for PDFs is application/pdf:

    printIntent.setDataAndType(Uri.fromFile(new File("Report.pdf")), "application.pdf");
    

    I don’t actually have any experience with Android, so someone else might be able to better comment on determining the path for your report file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an android application in eclipse that needs to use JSON, Google
I'm developing an application for android with eclipse, and it has some logos (.jpg
We've been developing an Android application which includes Google Adsense. However there seems to
I am developing a small application on Google's android emulator. I am trying to
I am developing a simple android application using eclipse. I wrote a JUnit TestCase
I am having trouble with developing my Android application, I am currently using Eclipse
As part of the Android application I am developing in eclipse, I need to
I am developing an application in Eclipse build ID 20090920-1017 using android SDK 2.2
I am developing application using phonegap in eclipse for android .I have created folder
I am developing a mobile application in android using eclipse and phonegap. and my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.