i started using text app working on further android knowledge. cannot figure out how pdf filled , email using intent. have been googling , researching everywhere cannot find anything. know how go it?
declaration of file before oncreate;
file file = new file(getexternalfilesdir(null),"pvgform.pdf");
this part of code add info fillable pdf text
outputstream output = null; try { output = new fileoutputstream(file); } catch (filenotfoundexception e) { e.printstacktrace(); } try { reader = new pdfreader(getresources().openrawresource(r.raw.form)); } catch (ioexception e) { e.printstacktrace(); } try { pdfstamper stamper = new pdfstamper(reader, output); acrofields acrofields = stamper.getacrofields(); acrofields.setfield("fullname", edittext.gettext().tostring()); acrofields.setfield("agedob", edittext2.gettext().tostring()); acrofields.setfield("description", edittext3.gettext().tostring() + edittext4.gettext().tostring() + edittext5.gettext().tostring()); acrofields.setfield("duration", edittext6.gettext().tostring()); acrofields.setfield("brandname", edittext8.gettext().tostring()); acrofields.setfield("genericname", edittext9.gettext().tostring()); stamper.setformflattening(true); stamper.close(); } catch (documentexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } reader.close();
and attempt on email intent pdf form:
intent email = new intent(intent.action_send); email.putextra(intent.extra_subject, "my form"); email.putextra(intent.extra_text, "here form"); log.d("file",file.getabsolutepath()); uri uri = uri.fromfile(file); email.putextra(intent.extra_stream,uri); email.settype("application/pdf"); email.addflags(intent.flag_activity_new_task);
when run this, there no attachment email sent.
this part of code add info fillable pdf text
you not appear writing pdf file.
and attempt on email intent pdf form:
uri uri=uri.parse("file://"+ "form.pdf");
this not valid uri
on platform.
write pdf file, such on external storage. then, use uri
resolves file, using uri.fromfile()
convert file
object appropriate uri
.
Comments
Post a Comment