Tuesday, 22 July 2014

Acrobat PDF - Bad Parameter Issue

I've seen many facing the strange "Bad Parameters" issue with their PDF file in Adobe Acrobat. But I have yet not seen any official word from Adobe describing what it is and how it could be fixed. Anyways I have found my own workaround to the problem which I am sharing now. I hope this might be helpful to somebody.

Symptoms : You do either of Insert Pages, Extract Pages or Delete Pages on a PDF file in Acrobat. This action would pop up a strange Bad Parameter error as shown below. It is also observed that this error mostly occurs if the PDF Producer is not Adobe. Example - if someone has used the SaveAs PDF utility of MS Word to create the PDF.

Bad Parameter Issue
Bad Parameter Issue









Platform : I know of Windows 7. Have not tried on others.

Solution :

  • Do a right click on the black left vertical column of the Acrobat and select Tags.
Select Tags
Select Tags























  • From the dialog box that appears, select Tags. Do a right click and click Delete Tags.
    Delete Tag
    Delete Tag





















  • That's it!! Close the dialog and try again. The Bad Parameter issue must have been gone by now.

Friday, 18 July 2014

MS Word VSTO - Change Width and Height of Inline Shape

How do you programmatically change the Width and Height of an InlineShape in Word VSTO Application? This is a case where a user selects certain section of the Word Document and/or wants to change the width and/or the relative height of all the InlineShape objects.
  1. Your first step is to get the Selection object and eventually all the InlineShapes within the Selection.
    //Get all the selected inline shapes
    Word.Selection selection = wordApp.Selection;
    Word.InlineShapes inlineShapes = selection.InlineShapes;
    
  2. Your next step is to check whether the user have selected any InlineShapes or not. If they have selected the InlineShapes than we can loop through each one of the InlineShape.
    if (inlineShapes != null)
    {
       //Change the width & height of all selected inline shapes
       foreach (Word.InlineShape inlineShape in inlineShapes)
       {
       }
    }
    
  3. Now comes the part which we are most interested in!! Changing the Width and Height. The Width and Height properties sets the width and height of the InlineShape object's in points. An inch is equal to 72 points. So if you need to set the Width and Height to 5 Inches each, you would need to set these properties to 5 * 72 = 360 points each. But for our sake, we do not need to go into this calculations, as we have another built-int method InchesToPoints that helps us convert Inches to Points.
    float newValueInInches = 5.0F;
    float newValueInPoints = wordApp.InchesToPoints(newValueInInches);
    inlineShape.Height = newValueInPoints;
    inlineShape.Width = newValueInPoints;
    
THE COMPLETE CODE!!
//Get all the selected inline shapes
Word.Selection selection = wordApp.Selection;
Word.InlineShapes inlineShapes = selection.InlineShapes;

if (inlineShapes != null)
{
   //Set the new width in Points
   float newValueInInches = 5.0F;
   float newValueInPoints = wordApp.InchesToPoints(newValueInInches);

   //Change the width & height of all selected inline shapes
   foreach (Word.InlineShape inlineShape in inlineShapes)
   {
      inlineShape.Height = newValueInPoints;
      inlineShape.Width = newValueInPoints;
   }
}

Thursday, 3 July 2014

Image/Banner Slider

Wondering how can an image slider or a slideshow can be created? Image/banner slider is a great way to demonstrate all the top products or services your company provides. I saw many of the websites having them but din't knew how this can be done. One way to do this was to put Flash in there. But Flash becomes too heavy for this. This post demonstrates on how an image or banner slider can be created on your web application with simple javascript and jquery.

Few days back, out of the blue my client came up with the idea of putting the image slider of all the services he provides on the web application's Home Page. The idea was fantastic but I was little confused on how would I do this in .NET (or with simple HTML/javascript). I knew this can be done in Flash, but again Flash was not my cup of tea! I googled around to see if I can get some javascript or jquery that helps me accomplish this. And here I am! I found a wonderful Open Source Library that helps me create this slider.

Jssor Slider (both jQuery slider plugin and No-jQuery version) is touch swipe (touch+drag+move) & Responsive Image Slider with 360+ Javascript Slideshow Effects. With 30+ jQuery javascript+html simple code templates, it's easy to work out image slider, content slider, fade slideshow, thumbnail slider, nested slider, carousel slider, slider cluster, full width slider, grid slider, list slider, vertical slider, image gallery, banner slider, banner rotator, video gallery for website, webpage presentation. It supports all browsers and works on all mobile devices. It is one of the best performing sliders.

Jssor Slider comes with full open source javascript code library, thus user can develop, debug and deep customize slider of one's own. The following demostrates the usage of slider, including slider javascript code and slider HTML code.

Note that be sure to use 'jssor.core.js', 'jssor.utils.js' and 'jssor.slider.js' for development, and be sure to use 'jssor.slider.mini.js' for release. You know, all debug code will be removed after compression, to develop using 'jssor.slider.mini.js' may not meet your development needs.

Below is the most simple usage using jQuery

JAVASCRIPT CODE
<!-- it works the same with all jquery version from 1.x to 2.x -->
<script src="jquery.min.js"></script>
<script src="jssor.slider.mini.js"></script>
<script>
    jQuery(document).ready(function ($) {
        var options = { $AutoPlay: true };
        var jssor_slider1 = new $JssorSlider$('slider1_container', options);
    });
</script>

HTML CODE
<div id="slider1_container" style="position: relative; top: 0px; left: 0px; width: 600px; height: 300px;"&rt;
<div id="slider1_container" style="position: relative; top: 0px; left: 0px; width: 600px; height: 300px;">
    <!-- Slides Container -->
    <div u="slides" style="cursor: move; position: absolute; overflow: hidden; left: 0px; top: 0px; width: 600px; height: 300px;">
        <div><img u="image" src="image1.jpg" /></div>
        <div><img u="image" src="image2.jpg" /></div>
    </div>
</div>

That's it! You're done.

DEMO





Attachments and links :