tag:blogger.com,1999:blog-7970679050025899967.post7079977048285696703..comments2023-11-24T03:56:57.923-08:00Comments on Adobe LiveCycle Designer Cookbooks by BR001: Reading image properties in an Adobe LiveCycle Designer FormBR001http://www.blogger.com/profile/02005650446661555680noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-7970679050025899967.post-2047019101733042142020-11-10T03:51:28.761-08:002020-11-10T03:51:28.761-08:00Hi, Seems google has upgraded the Sites platform I...Hi, Seems google has upgraded the Sites platform I had the links pointing to and moved everything to google drive! Anyway I have updated the links for this post, and will work though the others.BR001https://www.blogger.com/profile/02005650446661555680noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-57733971936043389392020-11-09T06:50:22.960-08:002020-11-09T06:50:22.960-08:00Thank you so much... very useful indeed. Just wond...Thank you so much... very useful indeed. Just wondering about the download links. They seem to be broken. Appreciate it if you could get them back to download sample pdfs. Thanks.Unknownhttps://www.blogger.com/profile/15890489184391289580noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-41688848441501209052020-03-08T23:26:57.741-07:002020-03-08T23:26:57.741-07:00Hi, There is a lot of other stuff going on in the ...Hi, There is a lot of other stuff going on in the sample, hopefully it should be reasonably simple without the extra stuff.<br /><br />Have a look at this sample that just does the dimensions.<br /><br /><br />https://sites.google.com/site/livecycledesignercookbooks/ImageViewer.Dimension.pdf?attredirects=0&d=1BR001https://www.blogger.com/profile/02005650446661555680noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-28439887877151606912020-02-26T05:58:21.573-08:002020-02-26T05:58:21.573-08:00Hi, how would I go about getting the image dimensi...Hi, how would I go about getting the image dimensions from an image field? I see that you have done it in this example but I'm finding it hard to follow. Anonymoushttps://www.blogger.com/profile/16760195121840540430noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-59396487138346419472015-05-28T23:47:18.269-07:002015-05-28T23:47:18.269-07:00private static string reducirResolucionImagen(int... private static string reducirResolucionImagen(int idOperador, string imagenCadena, Int32 ancho)<br /> {<br /> if (imagenCadena == string.Empty) { return ""; }<br /><br /> //recupero la imagen almacenada en una matriz de bytes<br /> byte[] arrayBytes = Convert.FromBase64String(imagenCadena);<br /> <br /> <br /> string cadenaImagen;<br /><br /> //USING LIBERA DE LA MEMORIA el objeto stmBitmap UNA VEZ FINALIZADO EL BLOQUE, realiza de forma automatica un DISPOSE<br /> using (System.IO.MemoryStream stmBitmap = new System.IO.MemoryStream(arrayBytes, 0, arrayBytes.Length))<br /> { // Escribe el array de bytes en el stream de memoria<br /> stmBitmap.Write(arrayBytes, 0, arrayBytes.Length);<br /> // Carga la imagen del stream<br /> using (System.Drawing.Image ImagenFoto = System.Drawing.Image.FromStream(stmBitmap))<br /> {<br /> // Cierra el stream<br /> stmBitmap.Close();<br /> <br /> //si el ancho de la imagen es menor o igual no hago nada<br /> if (ImagenFoto.Width <= ancho) { return ""; }<br /><br /> //calculo el alto <br /> Int32 alto = (ancho * ImagenFoto.Height) / ImagenFoto.Width;<br /><br /> //este bloque USING libera de forma automatica el objeto imagenBitmap una vez finalizado el bloque<br /> using (Bitmap imagenBitmap = new Bitmap(ancho, alto, System.Drawing.Imaging.PixelFormat.Format32bppRgb))<br /> {<br /> imagenBitmap.SetResolution(Convert.ToInt32(ImagenFoto.HorizontalResolution), Convert.ToInt32(ImagenFoto.HorizontalResolution));<br /><br /> using (Graphics imagenGraphics = Graphics.FromImage(imagenBitmap))<br /> {<br /><br /> imagenGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;<br /> imagenGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;<br /> imagenGraphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;<br /> imagenGraphics.DrawImage(ImagenFoto, new System.Drawing.Rectangle(0, 0, ancho, alto), new System.Drawing.Rectangle(0, 0, ImagenFoto.Width, ImagenFoto.Height), GraphicsUnit.Pixel);<br /> }<br /> //Nota: no hace falta uso el bloque using libero la memoria<br /> //if (imagenGraphics != null) { imagenGraphics.Dispose(); }<br /> //if (ImagenFoto != null) { ImagenFoto.Dispose(); }<br /><br /> using (MemoryStream imagenMemoryStream = new MemoryStream())<br /> {<br /> imagenBitmap.Save(imagenMemoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);<br /> //puedo guardar la imagen en el disco duro<br /> //imagenBitmap.Save(@"C:\Users\emilioVillar\Desktop\CODIGOPRUEBA\" + (new Random(DateTime.Now.Millisecond)).Next() + "RESOLUCION.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);<br /><br /> //devuelvo la imagen en formato cadena de texto<br /> cadenaImagen = Convert.ToBase64String(imagenMemoryStream.ToArray());<br /> if (imagenMemoryStream != null) { imagenMemoryStream.Close(); }<br /> }<br /> }<br /> }<br /><br /> }<br /><br /> return cadenaImagen;<br /> }Emiliohttps://www.blogger.com/profile/00481648198895827794noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-29763042184806403342015-05-28T23:46:10.921-07:002015-05-28T23:46:10.921-07:00I finally reduced the size of the images using the...I finally reduced the size of the images using the iTextSharp library for c #. Here is the code here if anyone is interestedEmiliohttps://www.blogger.com/profile/00481648198895827794noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-56557179243464999312015-05-28T23:43:50.516-07:002015-05-28T23:43:50.516-07:00This comment has been removed by the author.Emiliohttps://www.blogger.com/profile/00481648198895827794noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-78430758003171710472015-05-23T16:04:37.110-07:002015-05-23T16:04:37.110-07:00Hi, Marian. As far as I know there is no way to ...Hi, Marian. As far as I know there is no way to get the file system filename. Maybe you could have a button and use the importDataObject and getDataObjectContents methods and try and load an Image object with that?BR001https://www.blogger.com/profile/02005650446661555680noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-91756291366472632882015-05-22T14:22:35.259-07:002015-05-22T14:22:35.259-07:00Is there a way to get an image's file name?Is there a way to get an image's file name?Marianhttps://www.blogger.com/profile/11882269114211627855noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-92051315431458715772015-02-15T12:50:50.004-08:002015-02-15T12:50:50.004-08:00I want to reduce the size of 4 megabytes to 1 mega...I want to reduce the size of 4 megabytes to 1 megabyte, not the size of visualization. This code is not useful to me. thanks anywayEmiliohttps://www.blogger.com/profile/00481648198895827794noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-50979056514209771172015-02-15T12:28:51.857-08:002015-02-15T12:28:51.857-08:00Hi Emilio,
Niall has a sample that maybe doing wh...Hi Emilio,<br /><br />Niall has a sample that maybe doing what you want, have a look at http://assuredynamics.com/index.php/portfolio/scaling-images/<br /><br />Regards<br /><br />BruceBR001https://www.blogger.com/profile/02005650446661555680noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-15653328938758091022015-02-15T10:34:35.675-08:002015-02-15T10:34:35.675-08:00Hi, I'm working on a project with LiveCycle, I...Hi, I'm working on a project with LiveCycle, I need to reduce the size of an image (4 megabytes) to a smaller size, it can be done, automatically, with Livecycle.<br />Hopefully you can help me, thanksEmiliohttps://www.blogger.com/profile/00481648198895827794noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-89085384436586217582013-08-23T20:43:01.324-07:002013-08-23T20:43:01.324-07:00Hi Radzmar,
I’m not sure about your base 64 encod...Hi Radzmar,<br /><br />I’m not sure about your base 64 encoding, if I encode the string 'ab\x00c' I get ‘YWIAYw’ or ‘YWIAYw==’ with the padding<br /><br />Follow these steps;<br />Text 'ab\x00c<br />ASCII 97, 98, 00, 99<br />Binary 01100001 01100010 00000000 01100011<br />64 Bit Binary 011000 010110 001000 000000 011000 110000<br />Base 64 Indexes 24 22 8 0 24 48<br /><br />Base 64 String (apply the indexes to this string) ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/<br /> 1 2 3 4 5 6<br />0123456789012345678901234567890123456789012345678901234567890123<br /><br />Base 64 Text YWIAYw<br /><br />I agree with your first comment, the value of an image field includes a newline character every 76 characters (just like it does if you "Embed Image Data" and then look in the XML Source). This is the main reason ImageField1.rawValue.length * 3 / 4 only gives you a rough image size (there can also be up to 3 padding characters).<br /><br />BruceBrucehttp://adobelivecycledesignercookbookbybr001.blogspot.com.au/noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-22508432146507312022013-08-21T01:20:02.022-07:002013-08-21T01:20:02.022-07:00Interesting Bruce,
I had a similar Problem when I...Interesting Bruce,<br /><br />I had a similar Problem when I saved Images from Images fields as attachments.<br />All Images above 50KB got damaged.<br /><br />I was able to solve it with the replace method and then also could decode 5 or 20 MB Images without any Problems.<br /><br />var b64Data = ImageField1.value.oneOfChild.value.replace(/\n/gm, "");<br />var ReadStream = Net.streamFromString(b64Data);<br />var DecodedStream = Net.streamDecode(ReadStream, "base64");<br />var NewAttachmentName = "MyExportImage_" + ".png";<br />event.target.createDataObject(NewAttachmentName, "", "image/png");<br />event.target.setDataObjectContents(NewAttachmentName, DecodedStream);<br /><br />So this may also work for you.<br /><br />var str = 'ab\x00c'<br />Net.stringFromStream(Net.streamEncode(Net.streamFromString(str.replace(/\x00|\n/gm, "")),'base64')) returns 'YWJj' as it should.radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-41982812181537698082013-08-08T16:32:04.471-07:002013-08-08T16:32:04.471-07:00Hi Radzmar,
The bug with the base 64 encoding see...Hi Radzmar,<br /><br />The bug with the base 64 encoding seems to be related to a null character in the input stream, which causes it to stop the encoding process. So if I was to encode ‘abc’ in the javascript console;<br /><br />console.println(Net.stringFromStream(Net.streamEncode(Net.streamFromString('abc'),'base64')))<br /><br />I would get 'YWJj', then if I was to decode it with;<br /><br />console.println(Net.stringFromStream(Net.streamDecode(Net.streamFromString('YWJj'),'base64')))<br /><br />I get back to 'abc', which is correct.<br /><br />However, if I try it with a null character in the string (the \x00 bit)<br /><br />console.println(Net.stringFromStream(Net.streamEncode(Net.streamFromString('ab\x00c'),'base64')))<br /><br />I get 'YWI=', which is the same as if the input string was 'ab', and that is what I get if I decode;<br /><br />console.println(Net.stringFromStream(Net.streamDecode(Net.streamFromString('YWI='),'base64')).toSource())<br /><br />John Brinkman referred to this issue in his blog http://blogs.adobe.com/formfeed/2009/08/base64_encode_a_pdf_attachment.html<br /><br />We generally use webservices for our form submissions and we wanted to be able to include attachments. Using base 64 encoding worked for simple text files, but if it was a Word document (or pretty much anything else) it was failing. We ended up using hex encoding which worked fine but means the attachment is twice the size when it is submitted. So we tend to limit an attachment to 5mb in the form (which means 10mb in the submission)<br /><br />This bug has also caused us problems trying to programmatically load images (using the FormCalc GET)<br /><br />Brucenoreply@blogger.comtag:blogger.com,1999:blog-7970679050025899967.post-55262038750371085352013-08-08T05:30:48.905-07:002013-08-08T05:30:48.905-07:00Hi,
this is a really brilliant sample!
Btw: What...Hi,<br /><br />this is a really brilliant sample!<br /><br />Btw: What bug with Base64 do you mean?radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.com